Solr Stats on Tuple - solr

I'm trying to use the Stats Component in my Datastax Solr instance.
The part of the schema I'm trying to get stats on looks like this:
<field name="foo" type="tuple" indexed="true" stored="true"/>
<field name="foo.start" type="bigint" indexed="false" stored="true"/>
<field name="foo.end" type="bigint" indexed="false" stored="true"/>
<field name="foo.time" type="int" indexed="true" stored="true"/>
However, when I try and use stats=true&stats.field={!tuple}foo.time with a *:* query I get the following:
"stats": {
"stats_fields": {
"foo.time": null
}
}
Is it not possible to use a {!tuple} for stats?

This is currently not supported unfortunately. Still you may contact Datastax support for further info.

Related

Solr Admin server - basic query request not returning results

I'm new to Solr and the Solrnet technology; I'm stumped with what seems to be something very basic; I haven't found any assistance on searching on the web.
I'm using Solr 8.1 and Solrnet 1.0.19
Using the Solr Admin console I'm able to query using the wildcard (*:*). However using a string that I know is in a document returns num found:0 (I have also been unsuccessful querying from the code).
Here's the code to index and delete my documents:
List<Course> eItems = JsonConvert.DeserializeObject<List<Course>>(File.ReadAllText(#"C:\PathTo\jsonFile\AllItems.json"));
try
{
var solr = SolrInstance.LocateSolrServer();
solr.Delete(SolrQuery.All);
solr.Commit();
foreach (Item eItem in eItems)
{
solr.Add(eItem);
}
//commit to the solr engine
solr.Commit();
I've added <schemaFactory class="ClassicIndexSchemaFactory"/> to the default solrconfig.xml.
I'm also using the default schema.xml file, I've just added my own fields:
<field name="idofitem" type="string" indexed="true" stored="true" required="false" multiValued="false" ></field>
<field name="titleofitem" type="text_general" indexed="true" stored="true" required="false" multiValued="false" ></field>
<field name="urlofitem" type="text_general" indexed="true" stored="true" required="false" multiValued="false" />
<field name="subjectofitem" type="text_general" indexed="true" stored="true" required="false" multiValued="false" />
<uniqueKey>idofitem</uniqueKey>
I've been unable to get past this problem; please if anyone has any suggestions...I'm stumped.

Search in json nested fields (schema + query)

I got the following JSON stored in a Riak bucket which handle Solr research.
{
"date" : 1535673489,
"customer" : {
"name" : "X"
"id" : 1205643
}
}
And my schema.xml fields look like that for the moment
<field name="_version_" type="long" indexed="true" stored="true"/>
<field name="date" type="int" indexed="true" stored="true" mult iValued="true"/>
And the research on date works perfectly fine with query as
$RIAK_HOST/search/query/order?wt=json&q=date:[1535553489%20TO%201535599999]
Unfortunately I didn't found any documentation that explains how to properly field and query on sub field as customer.name or customer.id
Edit: As I found on the following post Riak search schema and nested fields, it seems that I need to create the fields as follow:
<field name="customer_name" type="string" indexed="true" stored="true" mult iValued="true"/>
But then when I query on the fields, I got no answer to my request
Edit 2: I proceed to the following experimentation and I get no error from riak.
I uploaded the file
{
"customer_name" : "toto",
"customer" : {
"name" : "tata"
}
}
And on research Riak obtained the result from the field "toto" and not the one from "tata". Is it possible that the nesting research is unactivated or associated to another character?
The fields you need to add to your schema.xml are as follows:
<field name="date" type="string" indexed="true" stored="true"/>
<field name="customer" type="string" indexed="true" stored="true" multiValued="true"/>
<field name="customer.name" type="string" indexed="true" stored="true"/>
<field name="customer.id" type="string" indexed="true" stored="true"/>
And then you need to query your index as follow:
$RIAK_HOST/search/query/order?wt=json&q=customer.name:t*

How to write nested schema.xml in solr?

How to write nested schema.xml in solr
The document in schema.xml says
<!-- points to the root document of a block of nested documents. Required for nested
document support, may be removed otherwise
-->
<field name="_root_" type="string" indexed="true" stored="false"/>
http://svn.apache.org/viewvc/lucene/dev/trunk/solr/example/solr/collection1/conf/schema.xml?view=markup
Which can be used in
https://cwiki.apache.org/confluence/display/solr/Other+Parsers#OtherParsers-BlockJoinQueryParsers
What will be schema.xml for nesting the following items:
Person string
Address
city string
postcode string
I know this is an old question, but I ran into a similar issue. Modifying my solution for yours, the fields you need to add to your schema.xml are as follows:
<field name="person" type="string" indexed="true" stored="true" />
<field name="address" type="string" indexed="true" stored="true" multiValued="true"/>
<field name="address.city" type="string" indexed="true" stored="true" />
<field name="address.postcode" type="string" indexed="true" stored="true" />
Then when you run it you should be able to add the following JSON to your Solr instance and see the matching output in the query:
{
"person": "John Smith",
"address": {
"city": "San Diego",
"postcode": 92093
}
}

solr join function to query documents in multiple cores NullPointerException

I use solr join to query documents from two cores, my cores is defined as follows:
Post core:
<fields>
<!-- general -->
<field name="id"type="string"indexed="true"stored="true" multiValued="false" required="true"/>
<field name="creatorId"type="string"indexed="true"stored="true"multiValued="false" required="true"/>
.
.
.
</fields>
User core:
<fields>
<!-- general -->
<field name="id" type="string" indexed="true" stored="true" multiValued="false" required="true"/>
<field name="username" type="string" indexed="true" stored="true" multiValued="false" />
<field name="email" type="string" indexed="true" stored="true" multiValued="false" />
<field name="userBrief" type="string" indexed="true" stored="true" multiValued="false" />
<field name="jobNumber" type="string" indexed="true" stored="true" multiValued="false" />
</fields>
now I want to query all user who has created post, I use join function, my url is like this:
http://localhost:9080/solr/user/select?q=*:*&fq={!join from=creatorId to=id fromIndex=post}
but it don't work, and it throw a exception:
null: java.lang.NullPointerException
at org.apache.lucene.search.IndexSearcher.rewrite(IndexSearcher.java:559)
at org.apache.lucene.search.IndexSearcher.createNormalizedWeight(IndexSearcher.java:646)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:280)
.
.
.
I don't know why, can you help me?
The fq parameter requires a valid query with the !join.
Try adding an everything search to the end of the fq param like this. http://localhost:9080/solr/user/select?q=*:*&fq={!join from=creatorId to=id fromIndex=post}*:*
In a realistic setting you would likely want to filter the joined results in some way, for example, "Find me all action movies rated by this user updated in the past two weeks," where the movies and user ratings are stored as separate documents.

how to use UUID in solr schema

I know this:
<fieldType name="uuid" class="solr.UUIDField" indexed="true" />
<field name="id" type="uuid" indexed="true" stored="true" default="NEW"/>
<uniquekey>id</uniquekry>
Yes,it works , But I can update the same pdf , so it's duplicated.
I want use version3(md5) of uuid to crypte pdf files.
How can I do??

Resources