i use a server with solr 7.3.0 for testing. my scheme has some multivalued string fields like
<field name="rating" type="string" omitNorms="true" multiValued="true" indexed="true" stored="true"/>
On solr 7.3.0 a url query for sorting for the field "rating" works fine. Something like this:
server-name1:8983/sorl/core/search?q=*&sort=rating DESC
But recently i use a slave and the above mentioned solr 7.3.0 server is the master server.
The slave has a lesser version (7.2.1) installed. Because the server exists longer and this was was the latest version back then. I never bothered to update this yet.
But now the same query as above
server-name2:8983/sorl/core/search?q=*&sort=rating DESC
returns a error message:
"msg":"can not sort on multivalued field:rating"
My question is: is this just a recently implemented feature or did i miss something? I could update to 7.3.0 for the slave as well, but it just want to be sure if this is just a version issue.
Yes, this was implemented for 7.3.0. See SOLR-11854 - multiValued PrimitiveFieldType should implicitly sort on min/max based on the asc/desc keyword.
To find out if something has changed between versions, refer to the changelog for the new version. This is listed under the "New features" section:
SOLR-11854: multivalued primitive fields can now be sorted by implicitly choosing the min/max value for asc/desc sort orders. (hossman)
Related
Solr version 5.1.0
Documents contain DocValues field "ts" with timestamp using during ranking.
<field name="ts" type="long" docValues="true" indexed="true" stored="true" multiValued="false"/>
If I directly request document at Solr Admin UI I see that it contains correctly value:
"ts": 1575624481951
But when I added logs into the ranking method I saw that "ts" values for the same document is 0.
LeafReader reader = context.reader();
NumericDocValues timeDV = DocValues.getNumeric(reader, "ts");
long timestamp = timeDV.get(doc);
LOG.info("ts: " + timestamp);
Log:
ts: 0
Problem was in incorrect deleting document from Solr.
That was reproducing with next sequence of actions:
Firstly document was added to Solr without field "ts".
After some actions in app document was added again but with field "ts".
When Solr tried to ranking this document had not this field.
I added additional logs and saw that first version of document was on one shard and second version (with field "ts") was on another shard.
I don't pretty sure why it may happened because as I know Solr should put the same document on the same shard.
But anyway it was fixed with deleting document from index before adding second version.
Solr version information: 6.6.0
The core is named: solr
Instance: /var/solr/data/new_core
In the /var/solr/data/new_core/conf/ directory I have a custom schema.xml file
I have multiple custom fields like this in the schema.xml file
<field name="nid" type="int" indexed="true" stored="true"/>
When I select the 'solr' core and go to query, these custom fields are not showing up in the results. Here's an example of the results:
{
"response":{"numFound":200,"start":0,"docs":[
{
"id":"koe1eh/node/49",
"site":"https://example.com:1881/",
"hash":"koe1eh",
"ss_language":"und",
"url":"https://example.com:1881/node/49",
"ss_name":"tfadmin",
"tos_name":"tfadmin",
"ss_name_formatted":"tfadmin",
"tos_name_formatted":"tfadmin",
"is_uid":1,
"bs_status":true,
"bs_sticky":false,
"bs_promote":false,
"is_tnid":0,
"bs_translate":false,
"ds_created":"2009-03-12T17:46:06Z",
"ds_changed":"2009-06-18T15:25:33Z",
"ds_last_comment_or_change":"2009-06-18T15:25:33Z",
"tos_content_extra":" (Gifts) ",
"sm_field_apptype":["mousepad"],
"_version_":1588589404094464000,
"timestamp":"2018-01-03T16:28:34Z"}]
}}
The query performed is: http://example.com/solr/solr/select?indent=on&q=*:*&rows=1&wt=json
solrconfig.xml is here: https://pastebin.com/iVhZCqTW
schema.xml is here: https://pastebin.com/UBaUN5EK
I have tried restarting solr, reloading the core, and reindexing with no effect.
It turns out that I was just looking at some entries that did not have those fields. When I altered my query to start on record 900, then I saw the fields I was looking for. I'm not sure what else I may have done to get this working as I've been trying many different things.
I would like to use Solr highlighting, but our documents are only indexed and not stored. The field values are found in a separate database. Is there a way to pass in the text to be highlighted without Solr needing to pull that text from its own stored fields? Or is there an interface that would allow me to pass in a query, a field name, a field value and get back snippets?
I'm on Solr 5.1.
Lucene supports highlighting (returns offsets) also for non-stored content by using docValues.
Enabling a field for docValues only requires adding docValues="true" to the field (or field type) definition, e.g.:
<field name="manu_exact" type="string" indexed="true" stored="false" docValues="true" />
(introduced in Lucene 8.5, SOLR-14194)
You could reindex the resultset (read from database) in an embedded solr instance and run the query with same set of keywords with highlighting turned on and get the highlighted text back.
You could read the schema and solrconfig as resources from local jar and extract to temporary solr core directory to get this setup working.
I have the following error: [doc=testIngestID411] unknown field 'dateImport'
At the beginning I did not have the field 'dateImport' in my solr schema. I decided to add it after launching solr a few times.
1. I added this field to schema.xml:
<filed name="dateImport" type="string" indexed="true" stored="true" required="true"/>
after the other pre-existing fields.
I removed all my existing documents using :
<delete><query>*:*</query></delete>
Stopped SOLR (using ctrl+c or by killing the jar process)
Restarted SOLR (using java -jar start.jar)
Then, when I try to insert a document with a filed named dateImport I got :
"unknown field 'dateImport'"
Extra information:
If I modify one field which existed before (i.e which was there the first time I launched this SOLR core) the modification is well considered. For instance, if I change one field that was not required for required=true (and restart solr). Then I cannot add a document without specifying this field.
Also I have noticed, using the web admin interface:
On the left there is a tab call "Schema", this schema contains all modifications (like the field dateImport). Above this tab there is another tab named "Schema Browser". The field 'dateImport' DOES NOT appear here :( .
What can I do to get this new field working??
Thank you
Change <filed ... to <field ...
I am currently using SOLR 4.2 to index geospatial data (latitude and longitude data). I have configured my geospatial field as below.
<fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/>
<field name="latlong" type="location" indexed="true" stored="false" multiValued="true"/>
I just want to make sure that I am using the correct SOLR class for performing geospatial search since I am not sure which of the 2 class(LatLonType vs SpatialRecursivePrefixTreeFieldType) will be supported by future versions of SOLR.
I assume SpatialRecursivePrefixTreeFieldType is an upgraded version of latlong, can someone please confirm if I am right?
I generally recommend the SpatialRecursivePrefixTreeFieldType. It's better in many ways, but I wouldn't call it an "upgraded version of LatLonType" since that wording suggests it is a derivative which totally false. It's documented here: http://wiki.apache.org/solr/SolrAdaptersForLuceneSpatial4 The main reason to use LatLonType (perhaps in conjunction with the new field type) is for distance sorting/relevancy which is better implemented by LatLonType still (as of Solr 4.3).
I don't see LatLonType going away any time soon; Solr takes backwards compatibility pretty seriously.