Hi Erik,

thanks for the response. I have ensured the type is string and that the field is indexed. No luck though:

(Schema setting under solr/conf):
<field name="Word" type="string" indexed="true" stored="true" />

Query:

Word:apple

Desired result:

apple

Achieved Results:

apple, the red apple, pine-apple, etc, etc


I have also tried your other suggestion:
q={!" " f=Word}apple
(attmpting to eliminate any results with spaces)

But that just gives errors (from calling from the solr/admin query interface.

Am I doing something obviously wrong?

Thanks again,

Roland

>It's certainly quite possible with Lucene/Solr. But you have to index >the field to accommodate it. If you literally want an exact match >query, use the "string" field type and then issue a term query. >q=field:value will work in simple cases (where the value has no spaces >or colons, or other query parser syntax), but q={!term f=field}value is >the fail-safe way to do that.

>    Erik








Erik Hatcher wrote:
It's certainly quite possible with Lucene/Solr.  But you have to index the field to 
accommodate it.  If you literally want an exact match query, use the "string" 
field type and then issue a term query.  q=field:value will work in simple cases (where 
the value has no spaces or colons, or other query parser syntax), but q={!term 
f=field}value is the fail-safe way to do that.

        Erik

On Nov 2, 2011, at 07:08 , Roland Tollenaar wrote:

Hi,

I am trying to do a search that will only match exact words on a field.

I have read somewhere that this is not what SOLR is meant for but I am still 
hoping that its possible.

This is an example of what I have tried (to exclude spaces) but the workaround 
does not seem to work.

Word:apple NOT " "

What I am really looking for is the "=" operator in SQL (eg Word='apple') but I 
cannot find its equivalent for lucene.

Thanks for the help.

Regards,

Roland




Reply via email to