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 Héctor Trujillo <he...@gmail.com> on 2011/09/20 09:57:55 UTC

Problemns querying for the keyword "a"

  Hi all, I have find something curious probing Solr, and SolrJ, I don’t
know If this is normal, a reserved word, or a Bug could be. I can’t explain
it and I write here this question to get a reasonable explanation of this,
If it exists.

 I created an index and I inserted about ten documents. I defined a filed
named source, and I created many rows with the value “a” in this field, and
then I started to make queries, and then I took conscience that all the
queries that asked for the value “a” always returned zero rows, and this may
return 4 rows as result because I’ve inserted 4 rows with this value. I made
this query with SolrJ from Java, and then I did it with the solr Admin Web
interface example that comes with Solr, and I got the same results, zero
rows when I may got four rows for this result.

I’m a beginner in Solr, and I don’t know If this is a question of a
tokenizer or a query filter or a configuration that I’m using, and I may not
us.

The query:

source:a

And I got this response:



<response>

<lst name="responseHeader">

<int name="status">0</int>

<int name="QTime">0</int>

<lst name="params">

<str name="indent">on</str>

<str name="start">0</str>

<str name="q">source:a</str>

<str name="rows">10</str>

<str name="version">2.2</str>

</lst>

</lst>

<result name="response" numFound="0" start="0"/>

</response>



If I make a query for the keyword "b", source:b, I got all the results that
I expected.

Thanks to all, and I expect that someone could explain me this especial
behaviour, and sorry for my ignorance.

Re: Problemns querying for the keyword "a"

Posted by Héctor Trujillo <he...@gmail.com>.
Yes exactly this is the reason, "the trees didn't let me see the forest",
thanks for your perfect and fast response.

2011/9/20 Gora Mohanty <go...@mimirtech.com>

> 2011/9/20 Héctor Trujillo <he...@gmail.com>:
> [...]
> >  I created an index and I inserted about ten documents. I defined a filed
> > named source, and I created many rows with the value “a” in this field,
> and
> > then I started to make queries, and then I took conscience that all the
> > queries that asked for the value “a” always returned zero rows
> [...]
>
> Take a look at your Solr schema in schema.xml, and stopwords.txt.
> It is very likely that "a" is being removed as a stop word.
>
> Normally, one wants this behaviour, otherwise search results would
> be cluttered with matches for simple words like "a", "an", "the", etc.
>
> Regards,
> Gora
>

Re: Problemns querying for the keyword "a"

Posted by Gora Mohanty <go...@mimirtech.com>.
2011/9/20 Héctor Trujillo <he...@gmail.com>:
[...]
>  I created an index and I inserted about ten documents. I defined a filed
> named source, and I created many rows with the value “a” in this field, and
> then I started to make queries, and then I took conscience that all the
> queries that asked for the value “a” always returned zero rows
[...]

Take a look at your Solr schema in schema.xml, and stopwords.txt.
It is very likely that "a" is being removed as a stop word.

Normally, one wants this behaviour, otherwise search results would
be cluttered with matches for simple words like "a", "an", "the", etc.

Regards,
Gora