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 Arun Rangarajan <ar...@gmail.com> on 2013/06/26 22:02:14 UTC
How to get values of external file field(s) in Solr query?
http://docs.lucidworks.com/display/solr/Working+with+External+Files+and+Processes
says
this about external file fields:
"They can be used only for function queries or display".
I understand how to use them in function queries, but how do I retrieve the
values for display?
If I want to fetch only the values of a single external file field for a
set of primary keys, I can do:
q=_val_:"EXT_FILE_FIELD"&fq=id:(doc1 doc2 doc3)&fl=id,score
For this query, the score is the value of the external file field.
But how to get the values for docs that match some arbitrary query? Is
there a syntax trick that will work where the value of the ext file field
does not affect the score of the main query, but I can still retrieve its
value?
Also is it possible to retrieve the values of more than one external file
field in a single query?
Re: How to get values of external file field(s) in Solr query?
Posted by chitrapatel <ch...@gmail.com>.
I have implemented ExternalFileField in solr. But I am not able to write
values into external file "external_BestSellerTest" that is located into
~\data directory inside solr core.
My application and Solr Server were physically separated on two place.
Application will calculate a score and generate a file for
ExternalFileField. So, I need to post this external file into solr
directory. How to do this?
Help me to write values into that external file.
--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-get-values-of-external-file-field-s-in-Solr-query-tp4073467p4237367.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: How to get values of external file field(s) in Solr query?
Posted by Mikhail Khludnev <mk...@griddynamics.com>.
On Fri, Oct 4, 2013 at 12:24 AM, Peter Keegan <pe...@gmail.com>wrote:
> But how to get the values for docs that match some arbitrary query?
You can specify eff in fl param. it's implied by
http://docs.lucidworks.com/display/solr/Function+Queries
--
Sincerely yours
Mikhail Khludnev
Principal Engineer,
Grid Dynamics
<http://www.griddynamics.com>
<mk...@griddynamics.com>
Re: Filter execution threw an exception
Posted by Brian Robinson <br...@socialsurgemedia.com>.
Sorry, I'll get that information and start a new thread.
On 10/3/2013 4:50 PM, Shawn Heisey wrote:
> On 10/3/2013 3:12 PM, Brian Robinson wrote:
>> I'm using PHP Pecl to create my index, and am getting an error that I
>> can't figure out. I've pared my code down to the below. I've verified
>> that the database query is pulling in data correctly, and the $solrDocs
>> array has the expected number of items, but I'm getting an error thrown
>> by the addDocuments method.
>
> <snip>
>
>> and the error is "Filter execution threw an exception"
>
> When starting a new discussion on a mailing list, please create a new
> message rather than replying to one that you have received.
>
> http://people.apache.org/~hossman/#threadhijack
>
> I can show you a graphical example (with your specific message) of why
> this is a problem:
>
> https://dl.dropboxusercontent.com/u/97770508/thread-hijacking.png
>
> Now to address your actual email:
>
> Can you please find the Solr log on your server (not the Logging tab
> in the admin UI) and give us the error message(s) that your update
> request generates? Please include the entire stacktrace for each
> error, not just the first line or two. We will also need to know the
> exact Solr version you are running.
>
> There is one pecl solr bug that I know of, and as far as I know it's
> unresolved. The last two messages on the bug (and the patch that goes
> with them) are mine:
>
> https://bugs.php.net/bug.php?id=62332
>
> Thanks,
> Shawn
>
>
Re: Filter execution threw an exception
Posted by Shawn Heisey <so...@elyograg.org>.
On 10/3/2013 3:12 PM, Brian Robinson wrote:
> I'm using PHP Pecl to create my index, and am getting an error that I
> can't figure out. I've pared my code down to the below. I've verified
> that the database query is pulling in data correctly, and the $solrDocs
> array has the expected number of items, but I'm getting an error thrown
> by the addDocuments method.
<snip>
> and the error is "Filter execution threw an exception"
When starting a new discussion on a mailing list, please create a new
message rather than replying to one that you have received.
http://people.apache.org/~hossman/#threadhijack
I can show you a graphical example (with your specific message) of why
this is a problem:
https://dl.dropboxusercontent.com/u/97770508/thread-hijacking.png
Now to address your actual email:
Can you please find the Solr log on your server (not the Logging tab in
the admin UI) and give us the error message(s) that your update request
generates? Please include the entire stacktrace for each error, not
just the first line or two. We will also need to know the exact Solr
version you are running.
There is one pecl solr bug that I know of, and as far as I know it's
unresolved. The last two messages on the bug (and the patch that goes
with them) are mine:
https://bugs.php.net/bug.php?id=62332
Thanks,
Shawn
Filter execution threw an exception
Posted by Brian Robinson <br...@socialsurgemedia.com>.
Hello,
I'm using PHP Pecl to create my index, and am getting an error that I
can't figure out. I've pared my code down to the below. I've verified
that the database query is pulling in data correctly, and the $solrDocs
array has the expected number of items, but I'm getting an error thrown
by the addDocuments method.
Here is my code:
$lastUpdate = '2013-09-31';
$prod_result = $db_connect->query("
SELECT DISTINCT p.id, p.prodName, p.brand, bi.brandName,
p.description, p.lastUpdate
FROM product_CJ p
INNER JOIN brands_inactive bi ON bi.feedID = p.brand
WHERE p.showProd='Y' AND p.lastUpdate > ? LIMIT 0, 1",
array($lastUpdate)
);
$docArray = array();
while ($prod_row = $prod_result->fetchRow(DB_FETCHMODE_ASSOC)) {
$docArray[$prod_row['id']] = $prod_row;
}
$solrDocs = array();
foreach ($docArray AS $prod_row) {
$tmpProdID = $prod_row['id'];
$doc = new SolrInputDocument();
$doc->addField('id', $tmpProdID);
$doc->addField('prodName', $prod_row['prodName']);
$doc->addField('brand', $prod_row['brand']);
$doc->addField('brandName', $prod_row['brandName']);
$doc->addField('description', $prod_row['description']);
$tmpUpdate = $prod_row['lastUpdate']."T00:00:00Z";
$doc->addField('lastUpdate', $tmpUpdate);
$solrDocs[] = $doc;
}
foreach (array_chunk($solrDocs, 500) AS $solrChunk) {
$client->addDocuments($solrChunk);
}
and the error is "Filter execution threw an exception"
Does anyone know what this error might mean?
Thanks,
Brian
Re: How to get values of external file field(s) in Solr query?
Posted by Peter Keegan <pe...@gmail.com>.
In 4.3, frange query using an external file works for both q and fq. The
Solr wiki and SIA both state that ExternalFileField does not support
searching. Was the search/filter capability added recently, or is it not
supported?
Thanks,
Peter
On Wed, Jun 26, 2013 at 4:59 PM, Upayavira <uv...@odoko.co.uk> wrote:
> The only way is using a frange (function range) query:
>
> q={!frange l=0 u=10}my_external_field
>
> Will pull out documents that have your external field with a value
> between zero and 10.
>
> Upayavira
>
> On Wed, Jun 26, 2013, at 09:02 PM, Arun Rangarajan wrote:
> >
> http://docs.lucidworks.com/display/solr/Working+with+External+Files+and+Processes
> > says
> > this about external file fields:
> > "They can be used only for function queries or display".
> > I understand how to use them in function queries, but how do I retrieve
> > the
> > values for display?
> >
> > If I want to fetch only the values of a single external file field for a
> > set of primary keys, I can do:
> > q=_val_:"EXT_FILE_FIELD"&fq=id:(doc1 doc2 doc3)&fl=id,score
> > For this query, the score is the value of the external file field.
> >
> > But how to get the values for docs that match some arbitrary query? Is
> > there a syntax trick that will work where the value of the ext file field
> > does not affect the score of the main query, but I can still retrieve its
> > value?
> >
> > Also is it possible to retrieve the values of more than one external file
> > field in a single query?
>
Re: How to get values of external file field(s) in Solr query?
Posted by Upayavira <uv...@odoko.co.uk>.
The only way is using a frange (function range) query:
q={!frange l=0 u=10}my_external_field
Will pull out documents that have your external field with a value
between zero and 10.
Upayavira
On Wed, Jun 26, 2013, at 09:02 PM, Arun Rangarajan wrote:
> http://docs.lucidworks.com/display/solr/Working+with+External+Files+and+Processes
> says
> this about external file fields:
> "They can be used only for function queries or display".
> I understand how to use them in function queries, but how do I retrieve
> the
> values for display?
>
> If I want to fetch only the values of a single external file field for a
> set of primary keys, I can do:
> q=_val_:"EXT_FILE_FIELD"&fq=id:(doc1 doc2 doc3)&fl=id,score
> For this query, the score is the value of the external file field.
>
> But how to get the values for docs that match some arbitrary query? Is
> there a syntax trick that will work where the value of the ext file field
> does not affect the score of the main query, but I can still retrieve its
> value?
>
> Also is it possible to retrieve the values of more than one external file
> field in a single query?
Re: How to get values of external file field(s) in Solr query?
Posted by Arun Rangarajan <ar...@gmail.com>.
Yonik,
Thanks, your answer works!
On Wed, Jun 26, 2013 at 2:07 PM, Yonik Seeley <yo...@lucidworks.com> wrote:
> On Wed, Jun 26, 2013 at 4:02 PM, Arun Rangarajan
> <ar...@gmail.com> wrote:
> >
> http://docs.lucidworks.com/display/solr/Working+with+External+Files+and+Processes
> > says
> > this about external file fields:
> > "They can be used only for function queries or display".
> > I understand how to use them in function queries, but how do I retrieve
> the
> > values for display?
> >
> > If I want to fetch only the values of a single external file field for a
> > set of primary keys, I can do:
> > q=_val_:"EXT_FILE_FIELD"&fq=id:(doc1 doc2 doc3)&fl=id,score
> > For this query, the score is the value of the external file field.
> >
> > But how to get the values for docs that match some arbitrary query?
>
> Pseudo-fields allow you to retrieve the value for any arbitrary
> function per returned document.
> Should work here, but I haven't tried it.
>
> fl=id, score, field(EXT_FILE_FIELD)
>
> or you can alias it:
>
> fl=id, score, myfield:field(EXT_FILE_FIELD)
>
> -Yonik
> http://lucidworks.com
>
Re: How to get values of external file field(s) in Solr query?
Posted by Yonik Seeley <yo...@lucidworks.com>.
On Wed, Jun 26, 2013 at 4:02 PM, Arun Rangarajan
<ar...@gmail.com> wrote:
> http://docs.lucidworks.com/display/solr/Working+with+External+Files+and+Processes
> says
> this about external file fields:
> "They can be used only for function queries or display".
> I understand how to use them in function queries, but how do I retrieve the
> values for display?
>
> If I want to fetch only the values of a single external file field for a
> set of primary keys, I can do:
> q=_val_:"EXT_FILE_FIELD"&fq=id:(doc1 doc2 doc3)&fl=id,score
> For this query, the score is the value of the external file field.
>
> But how to get the values for docs that match some arbitrary query?
Pseudo-fields allow you to retrieve the value for any arbitrary
function per returned document.
Should work here, but I haven't tried it.
fl=id, score, field(EXT_FILE_FIELD)
or you can alias it:
fl=id, score, myfield:field(EXT_FILE_FIELD)
-Yonik
http://lucidworks.com