I have title search with Lucene .net and facing problem with LIKE clause search.
I have tried below terms but it is matching whole word.
query.Add(new TermQuery(new Term("title", word.ToLower())), BooleanClause.Occur.MUST);
Also tried
query.Add(new TermQuery(new Term("title", word.ToLower())), BooleanClause.Occur.SHOULD);
Any idea how to apply LIKE clause?
I would guess you are probably looking for either Prefix or Wildcard queries.
In general, I'd recommend getting some level of understanding of the instantiable subclasses of Query, listed here.
Related
Our MarkLogic based web-application mostly uses cts.jsonPropertyValueQuery to access needed information.
We want to provide the possibility of wildcard searches against specific JSON properties.
What is the best way to do it?
Turning on one of the wildcard indexes for the whole database is not an option.
I figured out that adding a "wildcarded" parameter to the query itself may solve the problem:
cts.search(cts.jsonPropertyValueQuery("inventor", "R?th", ["wildcarded", "whitespace-sensitive"]));
But it may work slow due to the absence of indexes. Is there any way to create wildcard indexes only for that specific JSON property?
You could create a Path Field with an XPath to the inventor JSON field (and even for //inventor) and configure the field to have wildcard indexes, and then use a field query: cts.fieldValueQuery or cts.fieldWordQuery.
I am running a following AEM Query SQL2 on CRXDE and it is successfully returning me nodes as per following given screenshot.
But I need data like column wise (jcr properties) like SQL table. Can anyone help me if it is possible.
You can't do this with CRXDE. It shows only the path of the most outer node, even if the query has multiple columns. This is especially limiting, if your query uses joins.
In your case I would recommend the Query Builder. It has a totally different syntax, but the JSON or XML result contains all data you need.
I don't know other tools. As AEM developer I usually write a quick & dirty servlet, and let it run on my local instance (with production content)
Query Builder Debugger
http://localhost:4502/libs/cq/search/content/querydebug.html
Example Query
path=/content/we-retail/language-masters/en/experience
property=sling:resourceType
property.value=weretail/components/content/image
p.hits=full
p.nodedepth=2
Resulting JSON Query
http://localhost:4502/bin/querybuilder.json?p.hits=full&p.nodedepth=2&path=%2fcontent%2fwe-retail%2flanguage-masters%2fen%2fexperience&property=sling%3aresourceType&property.value=weretail%2fcomponents%2fcontent%2fimage
http://localhost:4502/bin/querybuilder.json?p.hits=full&p.nodedepth=2&path=%2fcontent%2fwe-retail%2flanguage-masters%2fen%2fexperience&property=sling%3aresourceType&property.value=weretail%2fcomponents%2fcontent%2fimage
Documentation
https://docs.adobe.com/content/help/en/experience-manager-64/developing/platform/query-builder/querybuilder-api.html
In your case especially see: Refining What Is Returned
You will find much more with Google, as the Query Builder is pretty old in AEM/CQ.
I am implementing full-text search with Laravel Scout and TNTSearch. Everything is working fine aside for the fact that my where clause is not effective in the search results.
return \App\Models\Ad::search('macbook')->where('school_id', 4)->get();
The code above is supposed to return search results for ads which school_id is 4, but it is not. Instead, it returns results for ads matching the search query irrespective of the where clause.
Is it that I am missing something or what?
I just realized that TNTSearch does not support filter yet.
I'm learning about how to filter results from a scan or query using Amazon's DynamoDB. I would expect an example filter to look like filter => name = Bob or some such. However, Amazon requires the use of a expression attribute such as filter => name = :person and then ExpressionAttributeValues => { ":person": {"S": "Bob"}}
This is confusing and hurts my head, why can't I use the simple name = Bob?
Official docs: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScan.html#FilteringResults
Apparently working example near end: https://github.com/aws/aws-cli/issues/1073
This type of syntax follows an approach that is similar to prepared statements that are used in SQL systems. This was a design decision that the DynamoDB team at AWS made. One of the reasons is to allow fields that conflict with the lengthy list of reserved words (including 'name' that you were using in your example) that are defined by DynamoDB.
Avoiding reserved words is actually performed by using the ExpressionAttributeNames attribute and specifying the attribute names. You were referencing ExpressionAttributeValues which is where the list of values is specified. More information is available on the Using Placeholders for Attribute Names and Values documentation page.
Another motivation of this design is to separate the statement from the parameter names and values, similar to prepared statements in SQL as I've already mentioned. While this may seem odd at first it has the added benefit of effectively sanitizing your inputs in a NoSQL sense avoiding possible malicious or unintentional problems with your user input affecting the behavior of your request on the interaction with DynamoDB.
By using Apache Cmis query, if I understand correctly, you can get either
a List of Cmis Folders (SELECT * FROM cmis:folder WHERE...)
a List of Cmis Documents (SELECT * FROM cmis:document WHERE...)
But what I need, is a List of cmisObjects. I need this abstraction, because I want to get all the children (Folder or Document) of the selected Parent Folder.
Using 2 queries (1 for each type) is not an option, as I also have to use paging (using OperationContext.setMaxItemsPerPage) over the query results
EDIT : Just to make sure I made myself clear, I need to
Use the query Function, as I need to filter my results by using a specific custom aspect
Use Pagination, because even after filtering, the results (Folder Children) can be up to hundreds
This one has hit me years ago (I gave up on CMIS at that time). As of CMIS 1.1, there is this optional cmis:item. Have a look at http://docs.oasis-open.org/cmis/CMIS/v1.1/CMIS-v1.1.html#x1-220002 . You may be lucky and find that working with Alfresco. It might be required to use the v.1.1 implementation of the spec.
If that does not work, I guess your only option is to abondon CMIS for this query and either use another search service or roll your own.
Good luck ! ;)
If you know your parent, why don't you just call getChildren on the parent? Do you really have to use a query?
http://chemistry.apache.org/java/0.9.0/maven/apidocs/org/apache/chemistry/opencmis/client/api/Folder.html#getChildren()