AEM query to search on jcr:content properties only - full-text-search

We have a requirement to search on the jcr:content data only, we don't want to search results the component nodes.
Has anyone has any idea about this?
Thanks,
Mayur

Even I had a similar issue, where I had to get data based on node name.
path=/content/geometrixx/en
nodename=jcr:content
In order to perform the search on a particular node. In the below example search key is 'available'.
path=/content/geometrixx/en
fulltext=available
fulltext.relPath=jcr:content
Reference: https://docs.adobe.com/docs/en/aem/6-1/develop/search/querybuilder-api.html
Hope this is helpful.

Use JCR-SQL2 queries: SELECT * FROM [cq:PageContent] WHERE NAME() = 'jcr:content'
You can extend the query if you want to find only the nodes having a specific property; e.g: jcr:content nodes having the jcr:title property equal to Bestseller: SELECT * FROM [cq:PageContent] AS node WHERE NAME() = 'jcr:content' AND CONTAINS(node.[jcr:title], 'Bestseller')

Related

How to make Country-State-City like search in elastic Search

I want to make dependent search like when user type country and select country then on next dropdown/text search result would be from that particular Countries state, after selecting state on next text search would only based on that selected state. can anyone help to achieve this kind thing via elastic search.
i am new to elastic Search and i had basic idea of it, but didn't get idea how to do this kind of stuff where i need to search from child and feel data like map
Fist, it is important to understand how Elasticsearch store its data. You can find this kind of info here: https://www.elastic.co/guide/en/elasticsearch/reference/master/documents-indices.html
So, basically what you need is build a query with two must terms.
One for the object type (Country, State, etc).
Other for the name ("Los Angeles", "Massachussets", etc). If you want a autocomplete feature you could add a wildcard query in your list. https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-wildcard-query.html
Obs: When you store your State object do not forget to store the Country name together. Since Elasticsearch is non relational you have to have Country name indexed in the State document.
Hope that it helps

Elastic Search and Search Ranking Models

I am new to Elastic Search. I would like to know if the following steps are how typically people use ES to build a search engine.
Use Elastic Search to get a list of qualified documents/results based on a user's input.
Build and use a search ranking model to sort this list.
Use this sorted list as the output of the search engine to the user.
I would probably add a few steps
Think about your information model.
What kinds of documents are you indexing?
What are the important fields and what field types are they?
What fields should be shown in the search result?
All this becomes part of your mapping
Index documents
Are the underlying data changing or can you index it just once?
How are you detecting new docuemtns/deletes/updates?
This will be included in your connetors, that can be set up in multiple ways, for example using the Documents API
A bit of trial and error to sort out your ranking model
Depending on your use case, the default ranking may be enough.
have a look at the Search API to try out different ranking.
Use the search result list to present the results to the end user

stored procedures search elastic search

I am trying to script a recursive search in elastic.
i know there are search-templates,but i am not finding examples like below scenario
`ex:-father= neo
1.search in person-index documents for father attribute
2.if father=neo return direct,else(here father=ted)
3.search for ted now and check if father=neo return indirect
or repeat step 3 till script find's ancestor if not found return not related when reached father = some constant like (pre-genator or ancient)
`
This eliminates for me to go for graph database, if i have only one relation .
another scenario like find all decedents of "neo"
There is no facility to do exactly what you are describing inside elasticsearch at the moment.
If number of ancestral generations is limited and they can be expressed as 1-to-many relationships, you can use multiple has_parent queries.
Alternatively, if it's possible, you can denormalize the data and store names of all ancestors for the given record in a single field. So the record would look like this:
{
"father": "neo",
"ancestors": ["neo", "ted", ... ]
}
Otherwise, you need to do these searches outside of elasticsearch.

Search for Property Types

I have to convert property types from String to Long.
Now I want to search with XPath, QueryBuilder,... all properties "prop1" with type String to convert them into Long.
All queries I tried are giving only all nodes where "prop1" exists.
/jcr:root/content/dam/images//element(*,dam:Asset)[jcr:content/metadata/tiff:ImageLength]
Is there a possibility to do that? Because e.g. on http://docs.jboss.org/exojcr/1.12.13-GA/developer/en-US/html/ch-jcr-query-usecases.html I haven't found anything which helps me.
Greetings
Sören
The only function related to property types offered by the JCR queries is the CAST(), but it doesn't allow you to filter the results. Therefore, you can't find nodes with given property type using XPath, SQL or SQL2. Filter the results manually, using JCR API and the Property#getType() method.

Search for substring in a node name in JCR using CQ querybuilder

I am trying to do a search in CRXDE in CQ using the CQ qurybuilder tool to find all node names(in the tree structure) that contain the character '#' but am not successful. Being new to the Querybuilder tool, I am not aware of the exact conditions to be used to do the same.
Kindly help.
I tried the following query in the /bin/querybuilder.json tool-type=nt:file&path=/content/dam/marketinghub&property=nodename&property.value=#
I think the property=nodename part is wrong. What should I mention as property name when I have to search in the node names itself and not in any specific property of the node?
Almost there, but it is not the property that you need to search, it is the name of the node.
You have a nodename predicate that gets this job done for you.
It accepts a pattern that you would like to search for. So in your case, the query would be
type = nt:file
path = /content/dam/marketinghub
nodename = *#*
The json querybuilder url would be
/bin/querybuilder.json?nodename=*%23*&path=%2fcontent%2fdam%2fmarketinghub&type=nt%3afile
For further learning on query builder, refer this doc.

Resources