#574: Conversion of Invenio query syntax to the Solr one
------------------------+------------------------------------------
Reporter: jani | Owner: jani
Type: defect | Status: new
Priority: critical | Milestone:
Component: WebSearch | Version: v0.99.3
Resolution: | Keywords: syntax Solr full text search
------------------------+------------------------------------------
Comment (by rchyla):
Replying to [ticket:574 jani]:
> (This task is relevant to the use case where Invenio uses external Solr
full-text index)
> The default Solr syntax is quite different from the Invenio/INSPIRE one:
> http://lucene.apache.org/java/2_9_1/queryparsersyntax.html
> e.g.
> * '+' != AND
The semantics of + is quite different from AND; AND joines clauses, "+" is
unary operator.
But I am surprised that AND is a problem inside Invenio, I thought that
the search is implemented as a search unit that receives one clause and
then search_engine combines it. Ie. the query "this +that"
is parsed into two clauses and two searches are done: 1) this, 2)that --
then combined. AND should not be sent to Solr.
But apparently it is not the case.
> * OR is the default operator!
You can change default operators int the config
<requestHandler....>
<lst name="defaults">
<str name="defType">iq</str>
<str name="q.op">AND</str>
</lst>
</requestHandler>
> * '|' is not recognized
> * only operators written in capital letters are recognized
>
> Two solutions are possible:
> * a syntax converter in search_engine.py
> * a custom Solr plugin as descrited here:
http://wiki.apache.org/solr/SolrPlugins#QParserPlugin
The custom solr plugin is not the solution, I had to change the syntax
parser grammar (for solrpie and now it does recognize "|" and lowercase
'and', 'or', 'not' now -- even the strange things like '|word') It was not
easy, as lucene and Invenio understand some things differently, but it is
possible. For this stage, only the syntax converter in search_engine.py
can be the viable option.
--
Ticket URL: <http://invenio-software.org/ticket/574#comment:1>
Invenio <http://invenio-software.org>