[prev in list] [next in list] [prev in thread] [next in thread]
List: solr-user
Subject: Need help on this AND query, solr returning incorrect results?
From: Aaron Lewis <the.warl0ck.1989 () gmail ! com>
Date: 2014-10-15 2:46:32
Message-ID: CAJZVxR=YCGPd7ROHU92O1J6vAsqUq-fs0NkooTcBNq1QKdOAbw () mail ! gmail ! com
[Download RAW message or body]
Hi,
I've indexed two rows with two columns:
title: Google
subject: Java Interface
and another
title: FaceBook
subject: Not Java
Now I use this query:
title:"facebook" and subject:"java"
It returns both of the rows above, weird. It looks like an "OR" query
to me, hmm.
Attached the original PHP code (replace the `if (0)` if you're
inserting data for the first time)
------------------------------------------------------------------------------------------------------------------------------------------------
<?php
$solr = new SolrClient (array ('hostname' => '127.0.0.1'));
/////// INSERT ////////
if (0)
{
$data = array (
array (
'id' => 100,
'title' => 'Google',
'subject' => 'Java Interface'
),
array (
'id' => 101,
'title' => 'FaceBook',
'subject' => 'Not Java'
)
);
foreach ($data as $input)
{
$doc = new SolrInputDocument();
foreach ($input as $key => $value)
{
$doc->addField ($key, $value);
}
$solr->addDocument ($doc, false, 1000);
}
sleep (3);
}
/////// QUERY ////////
$query = new SolrQuery();
$query->setQuery('title:"facebook" and subject:"java"');
$query->addField('id')->addField('title')->addField('subject');
$resp = $solr->query($query)->getResponse ();
print_r ($resp->response->docs);
?>
--
Best Regards,
Aaron Lewis - PGP: 0x13714D33 - http://pgp.mit.edu/
Finger Print: 9F67 391B B770 8FF6 99DC D92D 87F6 2602 1371 4D33
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic