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 m0rt0n <ra...@gmail.com> on 2012/01/24 16:02:23 UTC

Not getting the expected search results

Hello,

I am a newbie in this Solr world and I am getting surprised because I try to
do searches, both with the  browser interface and by using a Java client and
the expected results do not appear.

The issue is:

1) I have set up an entity called "via" in my data-config.xml with 5 fields.
I do the full-import and it indexes 

1.5M records:

<entity name="via" query="select TVIA, NVIAC, CMUM, CVIA, CPRO from
INE_VIAS">
            <field column="TVIA" name="TVIA" /> 
            <field column="NVIAC" name="NVIAC" /> 
            <field column="CMUM" name="CMUM" /> 
            <field column="CVIA" name="CVIA" /> 
            <field column="CPRO" name="CPRO" /> 
</entity>

2) These 5 fields are mapped in the schema.xml, this way:
   <field name="TVIA" type="text_general" indexed="true" stored="true" />
   <field name="NVIAC" type="text_general" indexed="true" stored="true" />
   <field name="CMUM" type="text_general" indexed="true" stored="true" />
   <field name="CVIA" type="string" indexed="true" stored="true" />
   <field name="CPRO" type="int" indexed="true" stored="true" />

3) I try to do a search for "Alcala street in Madrid":
NVIAC:ALCALA AND CPRO:28 AND CMUM:079

But it does just get two results (none of them, the desired one):
<doc><str name="CMUM">079</str><int name="CPRO">28</int><str
name="CVIA">45363</str><str name="NVIAC">ALCALA 

GAZULES</str><str name="TVIA">CALLE</str></doc>
<doc><str name="CMUM">079</str><int name="CPRO">28</int><str
name="CVIA">08116</str><str name="NVIAC">ALCALA 

GUADAIRA</str><str name="TVIA">CALLE</str></doc>

4) When I do the indexing by delimiting the entity search:

<entity name="via" query="select TVIA, NVIAC, CMUM, CVIA, CPRO from INE_VIAS
WHERE NVIAC LIKE '%ALCALA%'">

The full import does 913 documents and I do the same search, but this time I
get the desired result:

<doc><str name="CMUM">079</str><int name="CPRO">28</int><str
name="CVIA">00132</str><str name="NVIAC">ALCALA</str><str
name="TVIA">CALLE</str></doc>

Anyone can help me with that? I don't know why it does not work as expected
when I do the full-import of the whole lot of streets.

Thanks a lot in advance.


--
View this message in context: http://lucene.472066.n3.nabble.com/Not-getting-the-expected-search-results-tp3684974p3684974.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Not getting the expected search results

Posted by Erick Erickson <er...@gmail.com>.
First thing is that there's a helpful page for debuging this
called dataimport.jsp, see:
http://wiki.apache.org/solr/DataImportHandler

Second, and this is just a guess, what is your
<uniqueKey> defined in your schema? When Solr
adds documents, a document with the same
value in the field defined in <uniqueKey> as a
document already in the index causes the old
doc to be replaced by the new doc. So it's possible
that your select is replacing the document you want
in the first example, but not in the second.

Look on the admin/stats page. There are two numbers
reported here, numDoc and maxDocs. The difference
between these is the number of documents that have
been deleted from your index. The replacement I
outlined above is a delete followed by an add, so
if you start with a clean index and do your first import
and these numbers are different, then you are having
documents replaced...

Hope that helps
Erick

On Tue, Jan 24, 2012 at 7:02 AM, m0rt0n <ra...@gmail.com> wrote:
> Hello,
>
> I am a newbie in this Solr world and I am getting surprised because I try to
> do searches, both with the  browser interface and by using a Java client and
> the expected results do not appear.
>
> The issue is:
>
> 1) I have set up an entity called "via" in my data-config.xml with 5 fields.
> I do the full-import and it indexes
>
> 1.5M records:
>
> <entity name="via" query="select TVIA, NVIAC, CMUM, CVIA, CPRO from
> INE_VIAS">
>            <field column="TVIA" name="TVIA" />
>            <field column="NVIAC" name="NVIAC" />
>            <field column="CMUM" name="CMUM" />
>            <field column="CVIA" name="CVIA" />
>            <field column="CPRO" name="CPRO" />
> </entity>
>
> 2) These 5 fields are mapped in the schema.xml, this way:
>   <field name="TVIA" type="text_general" indexed="true" stored="true" />
>   <field name="NVIAC" type="text_general" indexed="true" stored="true" />
>   <field name="CMUM" type="text_general" indexed="true" stored="true" />
>   <field name="CVIA" type="string" indexed="true" stored="true" />
>   <field name="CPRO" type="int" indexed="true" stored="true" />
>
> 3) I try to do a search for "Alcala street in Madrid":
> NVIAC:ALCALA AND CPRO:28 AND CMUM:079
>
> But it does just get two results (none of them, the desired one):
> <doc><str name="CMUM">079</str><int name="CPRO">28</int><str
> name="CVIA">45363</str><str name="NVIAC">ALCALA
>
> GAZULES</str><str name="TVIA">CALLE</str></doc>
> <doc><str name="CMUM">079</str><int name="CPRO">28</int><str
> name="CVIA">08116</str><str name="NVIAC">ALCALA
>
> GUADAIRA</str><str name="TVIA">CALLE</str></doc>
>
> 4) When I do the indexing by delimiting the entity search:
>
> <entity name="via" query="select TVIA, NVIAC, CMUM, CVIA, CPRO from INE_VIAS
> WHERE NVIAC LIKE '%ALCALA%'">
>
> The full import does 913 documents and I do the same search, but this time I
> get the desired result:
>
> <doc><str name="CMUM">079</str><int name="CPRO">28</int><str
> name="CVIA">00132</str><str name="NVIAC">ALCALA</str><str
> name="TVIA">CALLE</str></doc>
>
> Anyone can help me with that? I don't know why it does not work as expected
> when I do the full-import of the whole lot of streets.
>
> Thanks a lot in advance.
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Not-getting-the-expected-search-results-tp3684974p3684974.html
> Sent from the Solr - User mailing list archive at Nabble.com.