Prashant Puri
Prashant Puri

Reputation: 2334

How to search in xml using solr?

I have XML data indexed in solr, for example:

<doc>
    <str name="arg1">These services</str>
    <str name="arg1_exact">These services</str>
    <str name="arg2">the Owings Mills campus</str>
    <str name="arg2_exact">the Owings Mills campus</str>
    <str name="namespace">reverb</str>
    <str name="rel">are located at</str>
    <str name="rel_exact">are located at</str>
    <float name="conf_f">0.936</float>
    <str name="id">reverb-273062579</str>
    <int name="num_extrs_i">2</int>
    <arr name="corpora_ss">
      <str>cw</str>
    </arr>
    <long name="_version_">1523088036550672385</long></doc>
<doc>

I have many such XML documents. I want to search for specific fields eg arg1 = These services. I would like to also allow searchers to do logical combinations of those.

I followed stackoverflow link, but it didn't help me. Can anyone help?

Help appreciated :)

Upvotes: 1

Views: 99

Answers (1)

redragons
redragons

Reputation: 94

Take a look at solr query syntax https://wiki.apache.org/solr/SolrQuerySyntax.

You might also want to look at https://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters which gives information on how an input query is analyzed. The analyzer is configured in schema.xml inside the solr core under "conf" directory

For instance,

http://:8983/solr//select?q=arg1:These AND arg1:Services or for a phrase search, http://:8983/solr//select?q=arg1:"These Services"

Upvotes: 1

Related Questions