Formulating Boolean Queries on Lemur Indri - information-retrieval

I am unable to write the following boolean query, using Indri Query Language. THe query I need to write is the following:
(Stana or Katic) AND (Jon or Huertas) AND (co-stars or colleagues)
I need the list of all documents, containing the above. How can I go about doing this?

I asked this question on SourceForge, where the author helped me solve this.
#band(#syn(Stana katic) #syn(jon huertas) #syn(co-stars colleague))
For more information, see the original discussion here.

Related

How to dynamically search/replace text with update in XQuery (exist-db)

My intention is to somehow clean source files automatically. How to do that in XQuery? (I am not interested in reconstructing the document in memory and storing it as a new one.) It is quite easy to do something similar in case of short and simple elements addressed directly, however, I can’t figure out how to do that dynamically for all the text nodes, if possible.
I would expect something like this could work:
update replace $div[contains(., 'chapter')] with replace(., 'chapter', 'Chapter')
This throws err:XPDY0002 Undefined context sequence for 'self::node()' [source: String]
Apparently, there is a problem in addressing the context with . in the replacing function. But maybe I don’t understand the update thing in general. I am only inspired by the bottom of this article.
Expression to the right of with is independent from expression to the left. So an explicit node/context is needed on both part :
update replace $div[contains(., 'chapter')] with replace($div, 'chapter', 'Chapter')

SQLite, text search FTS etc

I am doing some updates and repairs on some old D5 business stuff (freebie for friend) with SQLite3 so have to use Zeos 6.6
I would like to speed up a text search which currently uses two BLOB_TEXT Fields, "Class" and "Methods"
if not(cbSearchMatchCase.Checked) then
SearchText:=UpperCase(SearchText);
while not(dm.tbl.EOF) do
begin
SearchData:=dm.tbl.FieldByName(fldClass).AsString+' '+
dm.tbl.FieldByName(fldMethods).AsString;
if not(cbSearchMatchCase.Checked) then
SearchData:=UpperCase(SearchData);
MatchFound:=AnsiPos(SearchText,SearchData) > 0;
dm.tbl.Edit;
dm.tbl.FieldByName(fldSearch).AsBoolean:=MatchFound;
dm.tbl.Post;
pbMain.StepIt;
dm.tbl.Next;
end;
Can anyone point me at some code for using the SQLite FTS extension or something quicker than the above?
I found this but can't get it to work for way too many reasons to define here. I am sure it works as Žarko Gajić stuff is always spot-on, but just not working this installation. :)
http://zarko-gajic.iz.hr/full-text-txt- ... g-project/
Just find this link here...
Does BLOB data types in SQLite supports FULL-text search?
That might explain why nothing seems to work, The BLOB_TEXT is being ignored? Yes? No?
Any snippets to speed this Text Search up?
Why not to create index on class / method? It can be expression index: https://www.sqlite.org/expridx.html or even complex one. I would start with lower case, and then re-filter if case sensitivity is needed.

how to write syntax for key value fair symfony console

I want to update inventory based on sku.
For example
php magento update_inventory --sku&quantity=array(1001,10) --sku&quantity=array(1002,20) --sku&quantity=array(1003,30)
But I’m not getting how to add options/arguments ?
here user at least need to provide one pair (sku& quantity).
for this i think i have to use ArrayInput class/InputArgument/InputOption.
Can you give some solution or reference to above requirement?
Have you looked at how Magento\Setup\Console\Command\AdminUserCreateCommand uses options? Take a look at how that code uses getOptionsList in the configure method. For your use case you may want to look into using InputOption::VALUE_IS_ARRAY
A good reference will be http://symfony.com/doc/current/components/console/introduction.html#using-command-options
You may also want to consider a different input format. For example using arguments instead of options and specifying the format in documentation.
php magento update_inventory 1001:10 1002:20 1003:30

Plone Conditional - If Content Type is Versionable

Is there a simple way to check if a content-type, or a specific object, has Versioning enabled/disabled in Plone (4.3.2)?
For context, I am making some unique conditionals around portal_actions. So instead of checking path('object/##iterate_control').checkout_allowed(), I need to first see if versioning is even enabled. Otherwise, the action in question does not display for items that have versioning disabled, because obviously it isn't checkout_allowed.
I didn't have any luck with good ole Google, and couldn't find this question anywhere here, so I hope it's not a dupe. Thanks!
I was able to get this working by creating a new script, importing getToolByName, and checking current content type against portal_repository.getVersionableContentTypes(). Then just included that script in the conditional.
I was looking for something like this that already existed, so if anyone knows of one let me know. Otherwise, I've got my own now. Thanks again!
The first thing that checkout_allowed does is check if the object in question supports versioning at all:
if not interfaces.IIterateAware.providedBy(context):
return False
(the interface being plone.app.iterate.interfaces.IIterateAware:
class IIterateAware( Interface ):
"""An object that can be used for check-in/check-out operations.
"""
The semantics Interface.providedBy(instance) are a bit unfortunate for usage in conditions or TAL scripts, because you'd need to import the interface, but there's a reversal helper:
context.portal_interface.objectImplements(context,
'plone.app.iterate.interfaces.IIterateAware')

SQL Search Statement like Google?

Is there some kind of SQL Statement that I can used to do a search on 1 Column in my table that is similar to what I am looking for.
Like if I am looking for something to do with a "Car" but I spell it as "Kar" it must return items of "car".
Or
If I am looking for "My Company" and I spell it as "MyCompany" it must still retun "My Company".
Select * from TableName where Column Like '%company%' will return "My Company" but I need more as the user will not always know how to spell. So I need something more advanced like some small Google App or something...
That feature is in the text services so if you build a full-text search index, you should be able to use the feature.
Have a look here:
http://msdn.microsoft.com/en-us/library/ms187384.aspx
http://msdn.microsoft.com/en-us/library/ms142571.aspx
This is quite an involved problem. The quick answer is to use the SQL Server soundex algorithm, but it's pretty hopeless. Try the suggestions on this SO answer. (Updated)
Read this blog post: http://googlesystem.blogspot.com/2007/04/simplified-version-of-googles-spell.html
This is something you could implement with SQL, but it's not a built in feature.
Another way to help you users find what they are looking for is to implement type-ahead on the search field. If the user type: "my" he will get "My Company" as a suggestion and likely go with that.
You can easily implement type ahead using jquery or other javascript libraries. Here's a list of type ahead plugins for jQuery: http://plugins.jquery.com/plugin-tags/typeahead
No. A full text index might get you closer, depending on your requirements (what exact features are you looking for?) One option would be roll you own .NET assembly with the desired features add it (CREATE ASSEMBLY) to sql server and use that to search.

Resources