AEM 6.1 configuration for Search Sugesstion and StopWords - aem

We are using AEM6.1 and implementing OOTB search functionality. The requirement is that we have to implement StopWords(will not user to search common words such as like,for,is) and Spellcheck(Did you mean ?) features as part of this implementation.Can anyone suggest as the best way to achieve this requirement.
Thanks

You can configure stopwords in your oak index definition.
-fulltextIndex
- jcr:primaryType = "oak:QueryIndexDefinition"
- compatVersion = 2
- type = "lucene"
- async = "async"
+ analyzers
+ default
- class = "org.apache.lucene.analysis.standard.StandardAnalyzer"
- luceneMatchVersion = "LUCENE_47" (optional)
+ stopwords (nt:file)
Please check the following documentation on Oak[1].
To see more details on this it is better to follow the JIRA story on the Jackrabbit Oak Jira[2]. This was part of Oak1.1.2 and since AEM6.1 comes with Oak1.2.2, you should be able to configure the stop words directly.
[1] - https://jackrabbit.apache.org/oak/docs/query/lucene.html
[2] - https://issues.apache.org/jira/browse/OAK-2177

Related

Apache Wicket 9.7.0 resource bundle naming issue

I'm aggregating JavaScript resources like this
getResourceBundles().addJavaScriptBundle(MyWicketApplication.class,
"js_bundle.js",
wicketJQuery,
wicketAjax,
JavascriptResources.RESOURCE_1.getReference(),
JavascriptResources.RESOURCE_2.getReference(),
JavascriptResources.RESOURCE_3.getReference(),
JavascriptResources.RESOURCE_4.getReference(),
JavascriptResources.RESOURCE_5.getReference(),
JavascriptResources.RESOURCE_6.getReference(),
JavascriptResources.RESOURCE_7.getReference(),
JavascriptResources.RESOURCE_8.getReference());
What I get after a page is rendered is something like this
./wicket/resource/com.my.company.MyWicketApplication/js_bundle-ver-3CA0BF236223C36D08331F94E24FAAAE.js
I don't mind having the part
js_bundle-ver-3CA0BF236223C36D08331F94E24FAAAE.js
But how to hide / remove this part
./wicket/resource/com.my.company.MyWicketApplication
to something like this
/resources/js_bundle-ver-3CA0BF236223C36D08331F94E24FAAAE.js
You could use the result of getResourceBundles().addJavaScriptBundle(...) and mount it at specific path:
JavaScriptReferenceHeaderItem jsrhi = getResourceBundles().addJavaScriptBundle(...);
ResourceReference rr = jsrhi.getReference();
webApplication.mountResource("some/path", rr);

Wiremock response of a certain regex

I have to send a random value back from wiremocked response. I have seen examples using {{randomValue type='ALPHANUMERIC'}}
However I could not find anything where I can give randomvalue of a particular regex - say alphanumeric value which starts with ABC and 9 random digits.
I did try -
{{randomValue regex='ABC[0-9]{9}'}}
But this is not working. I am not sure if there is any other way to do this.Please guide me to any appropriate resource if available.
The only way to do this currently is via a custom Handlebars helper.
You can provide custom helpers when creating the templating transformer during startup e.g.
WireMockServer wm = new WireMockServer(wireMockConfig()
.dynamicPort()
.extensions(new ResponseTemplateTransformer(
false,
Collections.singletonMap("myHelper", new MyHelper()))
)
);
Where MyHelper should extend the HandlebarsHelper abstract class.

typo3 read configuration options in typoscript

I've tried several approaches to read the configuration options of my plugin in typoscript, but none of them seem to work
ajax.30 = TEXT
ajax.30.value = {plugin.tx_parser.settings.numVar}
ajax.40 < {tx_parser.settings.numVar}
ajax.50 < {tx_parser.settings.numVar}
ajax.80 = TEXT
ajax.80.value = {options.numVar}
ajax.90 = TEXT
ajax.90.value = {settings.numVar}
Can anyone please explain me the syntax or post a link where it is explained; I can use ext_conf_template.txt explained here https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ExtensionArchitecture/ConfigurationOptions/Index.html but I didn't get these options in typoscript.
All I want is to access (in typoscript) the configuration options of the following picture
If I browse Constants I don't see any of these options
If I add my plugin to the site I see some plugin options but none of them I wanted
You can use constants with this syntax in TypoScript setup or constants
var = {$plugin.tx_parser.settings.numVar}
So in your case:
ajax.30 = TEXT
ajax.30.value = {$plugin.tx_parser.settings.numVar}
See https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/UsingSetting/Constants.html
To assign an earlier declared setup value you would use the < (object copy) operator
ajax.30 = TEXT
ajax.30.value < plugin.tx_parser.settings.numVar
Here is an on overview of its syntax: https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/TypoScriptSyntax/Syntax/TypoScriptSyntax.html
The difference between constants and setup is essential. You can check in the backend in the module Template -> Template browser - see https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/UsingSetting/Debugging.html

getStructureId returns the real ID minus 1?

this is the code I am using :
JournalArticle article = null;
article = JournalArticleLocalServiceUtil.getLatestArticle(classPk);
String structureId = article.getStructureId();
When I debugged I found that structureId is always the real structureId but minus 1 !!!
Why ?? I need to know if it's Liferay bug ...
thank you,
I am Liferay 6.2 ce ga2.
JournalArticle's field structureId is equivalent not to DDMStructure.structureId, but to DDMStructure.structureKey. I admit, that can be really confusing.
This is due to the DDMStructure's object generation mechanism. When you add new structure using Control Panel, the structureKey is generated automatically using counterLocalService (check this code). As it happens just before the structureId is generated, it is always smaller by one.
See following Jira tickets, where it is explained the structureId vs structureKey issue:
- https://issues.liferay.com/browse/LPS-50671
- https://issues.liferay.com/browse/LPS-31163

How can I send URL variable to zend index controllers index action

http://example.com/index/index/color/red/id/230
For the above URL zend framework breaks it like the following -
module : default
controller : index
action : index
color : red
id : 230
But I want to skip the /index/index (/controller/action) part. What should I do to achieve the same result with the following URL -
http://example.com/color/red/id/230
Do I need to write a router for this? Please help me to build one. I tried the following in my routers.ini but it is now working -
routes.index.route = /
routes.index.defaults.module = default
routes.index.defaults.controller = index
routes.index.defaults.action = index
Please someone help me with this problem. Many many thanks in advance.
Yes, you'll need a route and you'll need to tell zend whats the route like. for example:
routes.index.route = "/color/:color/id/:id"
will give you something like: http://example.com/color/red/id/123
or even a bit shorter:
routes.index.route = "/color/:color/:id"
would give you http://example.com/color/red/123
your route above just points to the www root. thats why it's not working. btw. did you read this one? http://framework.zend.com/manual/en/zend.controller.router.html