How can I get lucene's docId from search result? - hibernate-search

I'm implementing FastVectorHighlighter in my application. But It requires docId.

You have to use a projection.
See this paragraph in the reference documentation:
https://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#projections
You even have an example of how to do it.
See especially the FullTextQuery.DOCUMENT_ID projection.

Related

mapbox gl setFilter by feature property that is an array

I have a feature property that is an array of ids:
feature.properties.ownerTypeIds: [1,2,3]
I have a form. In it it has a multi-select for Owner Types that produces an array: [1,2]
What is the mapbox gl latest version expression to compare a feature's array to an array of values? Match doesn't appear to support a feature property that is an array.
If ANY id in the feature's array is also in the selected choices array, I want it set to true. So that when it gets combined with many other filters inside an "all", it will work. The all works with many other filters, I just need help with the ownerTypeIds array scenario presented here.
Any value the user selects, is it inside the feature's ownerTypeIds array?
I'd appreciate any help. The mapbox expressions documentation doesn't appear to support feature properties that are an array. I hope I'm wrong in that assessment!
Appreciate you!
Thanks,
Donnie
From mapbox support ...
Hi Donnie,
Thanks for contacting Mapbox Support.
You are correct; only simple types are supported in Feature's properties.
With that said, you cannot compare the two lists at runtime using the style spec.
For your information, there is a publicly tracked issue here.
https://github.com/mapbox/mapbox-gl-js/issues/2434
One workaround would be to create a new property that computes whether an element in one array also exists in another array and sets a true/false value.
Then that boolean value can be used to compare in your filters.
Let me know if you still have any questions
Regards,

Remove Filter with Mapbox GL JS

Using Mapbox GL JS 0.39.1, I set a filter on my layer:
map.setFilter('myLayer', ['!=', 'myKey', 'myValue'])
I cannot find a way to remove the filter. I would have thought there would be a map.removeFilter... function but have found nothing in the docs or in web searches. I could apply a fake filter (>'') so that it always matches but that seems inefficient. Surely there is a way to remove a filter.
EDIT: I have found that using the following code will achieve what I am trying to accomplish. Not sure if this is the recommended approach.
map.setFilter('myLayer');
The docs were just updated, personally I would recommend using
map.setFilter('myLayer', null)
as it's more explicit and in my opinion makes the code more readable. Though your approach of just map.setFilter('myLayer'); is also acceptable.

MongoDB the difference between db.getCollection.find and db.tablename.find?

What is the difference between:
db.getCollection('booking').find()
and
db.booking.find()
Are they exactly the same, or when should I use which one?
db.getCollection('booking').find({_id:"0J0DR"})
db.booking.find({_id:"0J0DR"})
Yes, they are exactly the same and you can use either.
The first form db.getCollection(collectionName).find() becomes handy when your collection name contains special characters that will otherwise render the other syntax redundant.
Example:
Suppose your collection has a name that begin with _ or matches a database shell method or has a space, then you can use db.getCollection("booking trips").find() or db["booking trips"].find() where doing db.booking trips.find() is impossible.
I prefer using db.collection() to either as it will work on nonexistent collections, which is particularly useful when for example creating the first user in a users collection that doesn't yet exist.
db.collection('users').findOneAndUpdate(...) // Won't throw even if the collection doesn't exist yet
In addition to the previous answers, on the shell, they might be exactly the same but in real IDE (like PyCharm), db.getCollection(collectionName) gives you back the whole doculment even with out the find() method.

Difference between protractor locators

I was going through the protractor guide here: https://github.com/angular/protractor/blob/master/docs/api.md#api-protractor
It says in order to locate a element, I could use
var temp = element(by.css("someclass"));
or alternatively
var temp1 = ptor.findElement(protractor.By.css('someclass'))
Which kind of locator is to be used when ? Could someone pls clarify
They are the same. element is the preferred syntax because it is shorter and because you can chain locators and use some fancy protractor features. Protractor extends the webdriver api and that is why you can use the same functions that you would use in plain webdriver.
For example, the following expressions are equivalent:
ptor.findElement(by.css('.foo')).getText()
element(by.css('.foo')).getText()
$('.foo').getText()
To look for multiple elements use:
ptor.findElements(by.css('.foo'))
element.all(by.css('.foo'))
$$('.foo')
There are many examples in the api.md document:
https://github.com/angular/protractor/blob/master/docs/api.md#elementfinderprototypeelement
The difference between ptor.findElement and element is that the first should be used pages without Angular while the second is used on pages with Angular. This is related to how protractor syncs with Angular. The first returns a WebDriver WebElement, the second returns a Protractor ElementFinder.
However to address your question directly, there is no difference between the locators returned by by.css and protractor.By.css.
The two are equivalent. The object referenced by the global by object is the same as the the object referenced by protractor.By.
From Protractor's runner.js:
global.by = global.By = protractor.By;
There are two versions of the API. The old version used protractor.By, whereas the new version uses by. You may often see the old style but if you are in doubt, you can use the new style and be sure nothing unexpected will happen.

Does the w3c.org site have documentation on "select"?

I cannot work out where this doco might be - i'm assuming they do have something on it. I realise this is a dead simple question, but no amount of searching is bringing this up for me.
Bing/DuckDuck etc search cannot find anything particularly relevant, and the only w3c.org links I followed went to "functions", which apparently "select" isn't.
EDIT (Apologies for ambiguity) I am looking for the definition of something along the lines of :
<xsl:variable name="variableName" select="some/path/here" />
That is an XSLT variable. Like many other XSLT elements, it has a select attribute that takes an XPath expression as a value. The value of this attribute just typically happens to be an XPath expression, but the attribute itself isn't directly related to XPath, so you won't find it documented in the XPath spec.
You code fragment is in XSLT, so the specification you want is either "XSLT 1.0" or "XSLT 2.0", which you can find very easily by using these as Google search terms. The value of the select attribute is an XPath expression, so you may also want the XPath 1.0 or XPath 2.0 specification; these can be found the same way.