i'm having troubles on setting up Search API Solr on Drupal 8.
I have installed the modules:
Search API
Search Pages
Solr search
Solr search Defaults
Facets
I have indexed contents and configure the data source to have special content types. When i start a search on the view, solr search api returns two errors:
first is:
Notice: Array to string conversion in Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend->createId() (line 1098 of modules/search_api_solr/src/Plugin/search_api/backend/SearchApiSolrBackend.php).
that i found issue was the item id as an array ({ [0]=> string(16) "entity:node/2:fr" }) called at extractResults function to get solr_id
following by:
Warning: Illegal offset type in Drupal\search_api\Query\ResultSet->addResultItem() (line 97 of modules/search_api/src/Query/ResultSet.php).
Drupal\search_api\Query\ResultSet->addResultItem(Object) (Line: 1469)
Related
I'm setting up my first Solr server via docker using solr:8.11.1-slim. I am gonna use the schema API to set up the schema for my core whose name is 'products'.
While reading the docs there seems to be false info on the docs for field types:
https://solr.apache.org/guide/8_11/field-types-included-with-solr.html
vs.
https://solr.apache.org/guide/8_11/schema-api.html
I followed the first guide to get info on what field types I can specify and am trying to send requests based on the second doc such as this:
{ 'add-field': { "name":"latlong", "type":"LatLongPointSpatialField", "multiValued":False, "stored":True, 'indexed': True } },
but Solr gives me back errors such as:
org.apache.solr.api.ApiBag$ExceptionWithErrObject: error processing commands, errors: [{add-field={name=latlong, type=LatLongPointSpatialField, multiValued=false, stored=true, indexed=true}, errorMessages=[Field 'latlong': Field type 'LatLongPointSpatialField' not found
So what gives? Am I misreading the docs or are they wrong or is something wrong with the solr 8.11.1 image in docker? Why does it not accept the field types I'm providing?
Thanks for your help ahead of time.
I'm trying to perform a search sort using Sitecore 9.3 and SXA. The default search configuration allows the user to sort by 'Title'. The search logs shows queries with &sort=title_t desc which is expected.
If I change the sort criteria from Title to Other Title via /sitecore/content/[site name]/Global/Settings/Facets/Title to a field other than title, I no longer get results from the search results call.
Looking in the search log shows that Other Title is not being resolved to other_title_t with the error ERROR Solr Error : [sort param field can't be found: other_title ]
The Sitecore documentation https://doc.sitecore.com/developers/93/platform-administration-and-architecture/en/using-solr-field-name-resolution.html described the mechanism for resolving fields to the correct type using index config
<fieldType
fieldTypeName="html|rich text|single-line text|multi-line text|text|memo|image|reference"
returnType="text"
/>
...
</fieldTypes>
which is then used with the the type match to append _t to the field name
<typeMatches hint="raw:AddTypeMatch">
<typeMatch
typeName="text"
type="System.String"
fieldNameFormat="{0}_t"
cultureFormat="_{1}"
settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration,
Sitecore.ContentSearch.SolrProvider"
/>
</typeMatches>
This does not appear to be working for sort.
I've found that adding the fieldName (rather then rely on the preconfigured type mapping ) works and result in other_title_t being used as the query sort.
<fieldMap type="Sitecore.ContentSearch.SolrProvider.SolrFieldMap, Sitecore.ContentSearch.SolrProvider">
<fieldNames hint="raw:AddFieldByFieldName">
<field fieldName="other title" returnType="string" />
</fieldNames>
</fieldMap>
Should sort field resolution work via type field mapping already? Is this a bug?
I am new to Solr.
I created a Solr(8.1.0) core using SolrCloud for testing, and try to post data as a json file.
When an object has a value with float like "spalte412": "35.5" or with special characters, it throws an error in the in the console:
SimplePostTool: WARNING: Response: {
"responseHeader":{
"rf":2,
"status":400,
"QTime":223},
"error":{
"metadata":[
"error-class","org.apache.solr.common.SolrException",
"root-error-class","java.lang.NumberFormatException"],
"msg":"ERROR: [doc=52] Error adding field 'spalte421'='156.6' msg=For input string: \"156.6\"",
"code":400}}
I tried to edit core Schema by adding the field, in the Admin UI, without success.
Thanks for you help !
If you're not pre-defining your fields, the field types determined for the field will depend on the first document submitted that has that field present. Solr uses this field type to guess the type of the field, and in this case the guessed field type differs from the format you're sending in later documents.
The schemaless mode is neat for prototyping, but when moving to production you should always add the fields up front with the correct types so you don't suddenly get any surprises (as above) when the documents are submitted in a different order (or different documents) than when developing.
You can define fields in schema.xml or through the SchemaAPI.
You should post the schema.xml an an short description, what you did before.
"root-error-class","java.lang.NumberFormatException"
Sounds like solr war unable to understand that number format while your are trying to put a document with an stringt ( =For input string: \"156.6\"")
Sounds like you have a mismatch between a delivered and expected format.
Thanks guys.
indeed, I solved it by deleting the fields in the admin UI and defining with
curl -X POST -H 'Content-type:application/json' --data-binary '{"add-field": {"name":"name", "type":"text_general", "multiValued":false, "stored":true}}' http://localhost:8983/solr/films/schema
We are struggling to import certain files into Solr occasionally. It seems like certain documents have weird meta data (values), not sure if it might be from eccentric word processor or something else. See two examples here:
Type: Solarium\Exception\HttpException
Message: Solr HTTP error: OK (400)
{"responseHeader":{"status":400,"QTime":49},"error":{"metadata":["error-class","org.apache.solr.common.SolrException","root-error-class","java.lang.NumberFormatException"],"msg":"ERROR: [doc=3932487729] Error adding field 'brightness_value'='6.18' msg=For input string: \"6.18\"","code":400}}
And
Type: Solarium\Exception\HttpException
Severity: error --> Exception: Solr HTTP error: OK (400)
{"responseHeader":{"status":400,"QTime":72},"error":{"metadata":["error-class","org.apache.solr.common.SolrException","root-error-class","java.lang.NumberFormatException"],"msg":"ERROR: [doc=16996] Error adding field 'version'='5.3.1' msg=For input string: \"5.3.1\"","code":400}}
How do we prevent these issues? We are not in control of the documents, so need to fix it on the server.
Define the field type explicitly in the schema instead of relying on Solr to create the field type for you - the first document that contains the field will make Solr guess the type of the field, and if later documents doesn't match the same, expected format, you'll get an error like this.
Always define the schema for a collection when using it in production or in an actual application - the schemaless mode is really neat for prototyping and experimenting, but in an actual application you want the types to be well defined.
I've done Solr integration with Remote solr server and all the indexes were created, everything is fine.
Problem: I am not getting search result when I tried with OOTB metadata (dc:title) images though DAM Console search and asset viewer. It works only when I search on the node name GeoCube_Datasheet.pdf (Node name of type dam:Asset) . After I added a custom metadata for an Asset under jcr:content/metadata node, lets say dam:custom of type String, after I added another node under oak:index with below properties :
jcr:primaryType=oak:QueryIndexDefinition, reindex=true ( type Boolean) ,
propertyNames=dam:custom (type Name[]), type = property (type String).
After I modified schema.xml of Solr as :
<field name="dam:custom" type="matchall" />
After doing above configuration I can see the index is created in Solr Admin console. Solr admin console returns json output.
"path_exact": "/content/dam/geometrixx/portraits/scott_reynolds.jpg/
jcr:content/metadata", "jcr:primaryType": [ "nt:unstructured" ],
"dam:custom": [ "helloworld" ],
But When I do fulltext search in DAM console/ Asset viewer then Querybuilder does not return anything. But When I use default search engine (Lucene) then it returns records based on custom metadata.
For testing purpose when I executed this somehost:port/bin/querybuilder.json?fulltext=helloworld&type=dam:Asset then it does not return anything but it returns resukt when I executed somehost:port/bin/querybuilder.json?fulltext=helloworld&type=nt:unstructured
Please let me know what I'm missing here and how to get search result based on metadata
Thanks for your help!
You need to change Apache Jackrabbit Oak Solr Query index provider configuration in the felix console and enable the query time aggregation.