This sounds fishy... why are you using Solr if you are only indexing one field and it is the ID field?! That sounds like a particularly lame use of Solr.

Declare the field as a "string" field and then Solr won't break it up into tokens (other than special characters like slash.)

Or just set the defType="term" parameter. And the term query parser requires the "f" parameter to be set to the field (maybe that was your NPE). You can set those parameters in the "defaults" section of the request handler.

Or, you can you the real-time get handler, /get, which works fine for simple retrieval by ID (or even a list of IDs).

-- Jack Krupansky

-----Original Message----- From: Johannes Elsinghorst
Sent: Monday, August 12, 2013 11:18 AM
To: solr-user@lucene.apache.org
Subject: FW: looking for working example defType=term

Well, i couldnt get it work but maybe thats because im not a solr expert. What im trying to do is: I have an index with only one indexed field. This field is an id so I don't want the standard queryparser to try to break it up in tokens. On the client side I use solrj like this: SolrQuery solrQuery = new SolrQuery().setQuery("<id>"); QueryResponse queryResponse = getSolrServer().query(solrQuery);

I'd like to configure the TermQParserPlugin on the server side to minimize my queries.

Johannes
-----Original Message-----
From: Erik Hatcher [mailto:erik.hatc...@gmail.com]
Sent: Montag, 12. August 2013 17:10
To: Johannes Elsinghorst
Subject: Re: looking for working example defType=term

How are you using the term query parser? The term query parser requires a field to be specified.

I use it this way:

  q=*:*&fq={!term f=category}electronics

The "term" query parser would never make sense as a defType query parser, I don't think (you have to set the field through local params).

Erik


On Aug 12, 2013, at 11:01 , Johannes Elsinghorst wrote:

Hi,
can anyone provide a working example (solrconfig.xml,schema.xml) using the TermQParserPlugin? I always get a Nullpointer-Exception on startup: 8920 [searcherExecutor-4-thread-1] ERROR org.apache.solr.core.SolrCore รป java.lang.NullPointerException at org.apache.solr.search.TermQParserPlugin$1.parse(TermQParserPlugin.java:55)
      at org.apache.solr.search.QParser.getQuery(QParser.java:142)
at org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:142) at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:187) at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
      at org.apache.solr.core.SolrCore.execute(SolrCore.java:1904)
at org.apache.solr.core.QuerySenderListener.newSearcher(QuerySenderListener.java:64)
      at org.apache.solr.core.SolrCore$5.call(SolrCore.java:1693)
      at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)

solarconfig.xml:
 <lst name="defaults">
       <str name="echoParams">explicit</str>
  <str name="defType">term</str>
      <int name="rows">10</int>
      <str name="df">id</str>
    </lst>

Thanks,
Johannes




Reply via email to