You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Johannes Elsinghorst <j....@conterra.de> on 2013/08/12 17:01:34 UTC
looking for working example defType=term
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
Re: looking for working example defType=term
Posted by Jack Krupansky <ja...@basetechnology.com>.
There is nothing needed in either solrconfig or schema.xml to use the
TermQParserPlugin. It is built into Solr.
If you need an example of the syntax:
http://lucene.apache.org/solr/4_4_0/solr-core/org/apache/solr/search/TermQParserPlugin.html
or
http://wiki.apache.org/solr/QueryParser
-- Jack Krupansky
-----Original Message-----
From: Johannes Elsinghorst
Sent: Monday, August 12, 2013 11:01 AM
To: solr-user@lucene.apache.org
Subject: looking for working example defType=term
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
Re: looking for working example defType=term
Posted by Chris Hostetter <ho...@fucit.org>.
1) the "terM" parser doesn't use the "df" default field param -- it
requires an "f" local param.
2) because the "f" localparam is required, you can't really use "term" in
defType
3) what you can do is something like this...
q={!term f=id v=$qq}&qq=your_input_id
..where the "q" param can be an invariant in your config, and qq could be
specified at request time.
4) if all you care about is doing fast id lookups, you ight consider using
hte "RealTimeGet" request handler instead...
https://wiki.apache.org/solr/RealTimeGet
/get?id=your_input_id
-Hoss
Re: looking for working example defType=term
Posted by Michael Della Bitta <mi...@appinions.com>.
It's not even documents by ID... it's just IDs. Anything that does lookups
by ID could be used.
Michael Della Bitta
Applications Developer
o: +1 646 532 3062 | c: +1 917 477 7906
appinions inc.
“The Science of Influence Marketing”
18 East 41st Street
New York, NY 10017
t: @appinions <https://twitter.com/Appinions> | g+:
plus.google.com/appinions<https://plus.google.com/u/0/b/112002776285509593336/112002776285509593336/posts>
w: appinions.com <http://www.appinions.com/>
On Mon, Aug 12, 2013 at 11:51 AM, Walter Underwood <wu...@wunderwood.org>wrote:
> That does seem odd. To store and fetch documents by ID, use a document
> store. MongoDB might be a good match.
>
> wunder
>
> On Aug 12, 2013, at 8:47 AM, Jack Krupansky wrote:
>
> > 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.hatcher@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
> >>
> >>
> >
> >
>
> --
> Walter Underwood
> wunder@wunderwood.org
>
>
>
>
Re: looking for working example defType=term
Posted by Walter Underwood <wu...@wunderwood.org>.
That does seem odd. To store and fetch documents by ID, use a document store. MongoDB might be a good match.
wunder
On Aug 12, 2013, at 8:47 AM, Jack Krupansky wrote:
> 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.hatcher@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
>>
>>
>
>
--
Walter Underwood
wunder@wunderwood.org
Re: looking for working example defType=term
Posted by Jack Krupansky <ja...@basetechnology.com>.
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.hatcher@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
>
>
FW: looking for working example defType=term
Posted by Johannes Elsinghorst <j....@conterra.de>.
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.hatcher@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
>
>