简体   繁体   中英

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 :)

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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM