How to query custom AEM metadata in Solr - solr

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.

Related

solr 8.11 Field Types docs contradiction. Any guidance?

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.

Siecore template field type resolution and solr when performing search query with sort

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?

Search view solr Drupal

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)

Configuration and searching for Solr gettingstarted collection

I'm going through Solr Quick Start (version 6.2.0), which creates gettingstarted collection and then ingests docs/ folder, but cannot find more explanation about these two questions.
First, collection is created with this line from console:
Creating new collection 'gettingstarted' using command:
http://localhost:8983/solr/admin/collections?action=CREATE&name=gettingstarted&numShards=2&replicationFactor=2&maxShardsPerNode=2&collection.configName=gettingstarted
Where are schema and solrconfig.xml files for this collection?
And after documents are ingested, there are 4405 of them in index, all with title field. But when enter in q input field title:Solr, get this response
{
"responseHeader":{
"zkConnected":true,
"status":0,
"QTime":63,
"params":{
"q":"title:Solr",
"indent":"on",
"wt":"json",
"_":"1480494738956"}},
"response":{"numFound":0,"start":0,"maxScore":0.0,"docs":[]
}}
No documents are found, doesn't matter what is entered for title. Is it possible to search index by words in their title field?
Thanks
It looks like you are using SolrCloud example. In which case, the configuration is loaded into Zookeeper. So, the live version is not on the filesystem, as it would be with non-cloud examples. You can look at that via Admin UI instead.
If you just want to see the bootstrapped configuration, it is located in server/solr/configsets/ and the specific configuration depends what you chose when creating the example.
Config files will be in /server/solr/gettingstarted/conf
whenever you create new collection a folder with collection name is created inside server/solr/ inside that created folder there will be conf folder which contains config files(schema.xml, solrconfig.xml,etc) and data folder which contains index.
You should commit after you index documents into collection.

Map static field between nutch and solr

I use nutch 1.4 and I would like to map static field to Solr.
I know there is the index-static plugin. I configured it in nutch-site.xml like this :
<property>
<name>index-static</name>
<value>field:value</value>
</property>
However, the value is not sent to Solr.
Does anyone have a solution ?
It looks like the entry in nutch-default.xml is wrong.
According to the plugin source "index.static" instead of "index-static" is the right name for the property.
String fieldsString = conf.get("index.static", null);
After using that in my nutch-site.xml I was able to send multiple fields to my solr server.
Also make sure that the plugin is added to list of included plugins in the "plugin.includes" property.

Resources