Query : http://localhost:8983/solr/trackfleet_db.location/select?q=*:*&facet=true&facet.pivot={!stats=piv1}date,latitude,longitude&stats=true&stats.field={!tag=piv1}gpsdt
When I execute this query on a separate solr instance (which is not an instance of DSE) then this query works fine.
But in case of dse (Now I am using in built Solr of DSE) then it does not return anything ....And when I execute this query using curl command then it is giving following error
<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader">
<int name="status">400</int>
<int name="QTime">3</int>
</lst>
<lst name="error">
<lst name="metadata">
<str name="error-class">
org.apache.solr.common.SolrException
</str>
<str name="root-error-class">
org.apache.solr.common.SolrException
</str>
</lst>
<str name="msg">
undefined field: "!tag=piv1gpsdt"
</str>
<int name="code">400</int>
</lst>
</response>
Related
I tried backing up my collection using
http://xxxx:8983/solr/collection1/replication?command=backup&name=myTestbackup&location=/opt/solrBackupFolder
I was able to confirm that with /replication?command=details&wt=xml
<lst name="backup">
<str name="startTime">xxx xxx xx xx:xx:xx UTC xxxx</str>
<int name="fileCount">303</int>
<str name="status">success</str>
<str name="snapshotCompletedAt">xxx xxx xx xx:xx:xx UTC xxxx</str>
<str name="snapshotName">myTestbackup</str>
</lst>
For testing I am removing all the existing documents with
update?stream.body=<delete><query>*:*</query></delete> where i can see the Num Docs:0 in solr
After confirming the number of documents are 0 then I am using
http://xxxx:8983/solr/collection1/replication?command=restore&name=myTestbackup&core=collection1&location=/opt/solrBackupFolder
To restore my backup but it shows the below as my response when i restore
<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">0</int>
</lst>
</response>
and /replication?command=restorestatus this gives me
<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">0</int>
</lst>
</response>
the documentation(I am using this as there is nothing i found for 4.10 and backup works) says it should return a restorestatus but i never got it. Can someone help me if I am missing something?
I am using 'Facet' to find the count of top 3 most repeated words in a particular field say "msgs" which contains more than 10,000 records.
and I get the output similar to this.
word1 1600
word2 1536
word3 956
Now, along with the count, I want to display those particular fields which contain the above words. Any suggestions??
Okay. I hope I understand what you need. You could try query similar to this one:
http://solrhost:solrport/solr/select?q=your_query&rows=0&facet=true&facet.limit=-1&facet.field=your_facet_field1&facet.field=your_facet_field2
where
solrhost - Solr address
solrport - Solr port (default 8983)
your_facet_field1, etc - your field msgs
your_query could be : if you want to facet every document
Result will be something like this:
<response>
<responseHeader>
<status>0</status>
<QTime>2</QTime>
</responseHeader>
<result numFound="4" start="0" />
<lst name="facet_counts">
<lst name="facet_queries" />
<lst name="facet_fields">
<lst name="your_facet_field1">
<int name="search">0</int>
<int name="memory">0</int>
<int name="graphics">0</int>
<int name="card">0</int>
<int name="music">1</int>
<int name="software">0</int>
<int name="electronics">3</int>
<int name="copier">0</int>
<int name="multifunction">0</int>
<int name="camera">0</int>
<int name="connector">2</int>
<int name="hard">0</int>
<int name="scanner">0</int>
<int name="monitor">0</int>
<int name="drive">0</int>
<int name="printer">0</int>
</lst>
<lst name="your_facet_field2">
<int name="false">3</int>
<int name="true">1</int>
</lst>
</lst>
</lst>
</response>
I used to upload and index Word documents using the following url..
java -Durl=http://localhost:8983/solr/update/extract?literal.id=1 -Dtype=application/word -jar post.jar microfost_det.doc
When I query the Solr Index it returns XML as ..
http://localhost:8983/solr/collection1/select?q=microfost&wt=xml&indent=true
The Response was :
<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">0</int>
<lst name="params">
<str name="indent">true</str>
<str name="q">microfost</str>
<str name="_">1389196238897</str>
<str name="wt">xml</str>
</lst>
</lst>
<result name="response" numFound="1" start="0">
<doc>
<str name="id">1</str>
<date name="last_modified">1601-01-01T00:00:00Z</date>
<str name="author">fazlan </str>
<str name="author_s">fazlan </str>
<arr name="content_type">
<str>application/msword</str>
</arr>
<arr name="content">
<str>
This is a MSWord document. Microfost.
</str>
</arr>
<long name="_version_">1456677821213573120</long></doc>
</result>
</response>
Now my problem is , I need the name of the document that contains the queried text "microfost" that is , microfost_det.doc ..
Is it possible to get the name of the Word file (that is filename.doc) that contains the queried text ..
.
In Solr, the default searchable field is "content". That's why you are getting the result as it's matching with content. First create a custom string field (e.g docname) modifying your schema.xml
Then restart your Solr instance. Execute the following command to update your Solr doc.
curl 'http://localhost:8983/solr/update?commit=true' -H 'Content-type:application/json' -d '[{"id":"1","docname":{"set":"microfost_det.doc"}}]'
After that execute the following query and you'll get the result.
http://localhost:8983/solr/collection1/select?q=docname:microfost*&wt=xml&indent=true
Otherwise, while extracting the document execute the following command
java -Durl="http://localhost:8983/solr/update/extract?literal.id=1&literal.docname=microfost_det.doc" -Dtype=application/word -jar post.jar microfost_det.doc
Any way, you have to store the document name in a separate field.
I want to write a query that for ex. in sql psodocode like below
select * from temptable where price + 3 = 188;
Solr query i try is below
http://127.0.0.1:8983/solr/select/?fl=score,id&defType=func&q=sum(price,3):188
but i get below error. How can i query in solr? Please do not advice using "TO" keyword.
<response>
<lst name="responseHeader">
<int name="status">400</int>
<int name="QTime">1</int>
<lst name="params">
<str name="fl">score,id</str>
<str name="q">sum(price,3):188</str>
<str name="defType">func</str>
</lst>
</lst>
<lst name="error">
<str name="msg">
org.apache.solr.search.SyntaxError: Unexpected text after function: :188
</str>
<int name="code">400</int>
</lst>
</response>
frange query will do
{!frange l=188 u=188} sum(price,3)
My solr version is 4.0
I have a multicore environment with a core for products and a core for availability records of these products.
The products core will contain detailed descriptions and has about 10,000 douments.
The availabilities core contains up to 4 million documents.
I built a small testset and I'm trying to get results using the join syntax, meant to find alle availabilities of products containing "disney".
http://localhost:8080/solr/product/select?q={!join%20from=productid%20to=id%20fromindex=availp}disney&fl=*
I get zero results.
Individual queries on each of the cores do yield results.
Questions:
1. how should I construct the query in order to get results
2. when I refine my query for filtering for a specific date, what would the syntax be.
for example ?fq=period:"november 2012" AND country:France
country is a field from the product index, period is a field from then availp index.
Results from individual queries: product core
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">1</int>
<lst name="params">
<str name="fl">id,productname</str>
<str name="indent">1</str>
<str name="q">disney</str>
<str name="rows">1</str>
</lst>
</lst>
<result name="response" numFound="31" start="0">
<doc>
<str name="productname">DPAZ00 DPAZ00-02 DPAZ0002 Disneyland Parijs Hotel Disney's Santa Fe</str>
<str name="id">44044</str></doc>
</result>
</response>
other core: availp
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">0</int>
<lst name="params">
<str name="fl">*</str>
<str name="indent">1</str>
<str name="q">productid:44044</str>
<str name="rows">1</str>
</lst>
</lst>
<result name="response" numFound="42" start="0">
<doc>
<date name="datefrom">2012-10-01T10:00:00Z</date>
<arr name="period">
<str>oktober 2012</str>
</arr>
<str name="productid">44044</str>
<double name="minpriceperperson">209.0</double>
<int name="durationcode">1</int>
<str name="id">3890</str>
<int name="budgetcode">2</int>
</result>
</response>
1) You should query inventory core (with product as inner index).
This is how the query should be
http:// localhost:8080/solr/product/select?q=*& fl={!join from=id to=id fromIndex=availp}productname:disney
2) You can use the same query syntax above.
http:// localhost:8080/solr/product/select?q=period:november&fl={!join from=id to=id fromIndex=availp}productname:disney AND country:France
You can remove productname from above if not needed.
Have you tried by changing the fromindex to fromIndex (uppercase I)?
According to Adventures with Solr Join, the query look like this:
http://localhost:8983/solr/parents/select?q=alive:yes AND _query_:"{!join fromIndex=children from=fatherid to=parentid v='childname:Tom'}"
It should be works