Full text index and set a column as an attribute in sphinx? - linux

I am trying to full text search a column, but also be able to group by it. Does that mean it needs to be attribute? I want to still be able to search on the column though.

Use sql_field_string to make a column both a full-text field, and an attribute.
http://sphinxsearch.com/docs/current.html#conf-sql-field-string
Then you can query it, and sort/group by it.

Yes, you need attribute to use group by in Sphinx.
For example you could use crc32(text) of your text column. Like:
sql_query = select text, crc32(text) as text_crc from mytable
sql_attr_uint = text_crc
So, text will be used for full-text search and text_crc for group by.

Related

Can we specifiy order of columns to search in solr?

Can we specify order of columns to be searched in solr?
For example my search string is : "Test"
Then my result should contain all rows matching column1 and then all rows matching column 2... Similar to union query in SQL.
I tried with custom search handler which will fire multiple requests to solr and then append to get final result.
But is there any other way to get this type of search using SOLR?
I am using solr-5.4.1.
Thanks
You could use eDismax and match on both fields (I assume you mean columns by that). Then, use boosting to prioritize the matches in the first field to rank higher.
As an easy example, you would search against field1^10 field2, where ^10 is the boost factor. If that works but is not perfect, you can look into the documentation for other methods to apply boost.

ms sql search by nvarchar field

I am using MS SQl 2012 and have simple table
id (int) - primary key
fullname (nvarchar(500)
age (int)
…
In table over 15 millions records and I need make simple search like
select * from Customers where full name like '%sometext%'
Details:
1. It can have few words
2. There are used many languages
3. that fullname doesn't have any indexes yet
What the best way make search like that? Which indexes I should add? Can I use full text search if there are not only english words?
Sargable The above query does not meet the requirements therefore no index on your full name column is going to help. You will need to restructure your data or filter on something sargable first (age = 30) and then scan full name.
The other option is to pull in a text searching technology as #afrancis indicated.

SharePoint unique values from lookup

I have a list with a lookup column that is getting "Created" dates from another list, but I only want the unique date values. Is there a way to get this data or to create a calculated column with unique values?
A lookup field actually links to a single item, the display value is more a "human readable" value for the link to the items ID value.
You may also get some mileage from a normal text or even date field and using jQuery and SPServices on the edit and new forms in order to provide changes to the form for the user. This avoids doing a code level customisation for the site that a Custom Field would require.
Not out of the box I dont think. My best bet is to create a Custom Field type that extends lookup with the functionality you are after.

View Filtering in Xpages

I've been trying to filter the view by second sorted column but so far it doesn't work.
(my underlying view is sorted by first column categorized and sorted by ascending, and the second column is sorted by ascending order as well)
How can i get through this thing? and I don't want to create one more view for this filtering
To filter by multiple keys you need to use a Java Vector with the keys you want to filter by. Here's an example of applying a filter to a sessionScope variable that you then use for the keys property of the view:
var vArray = new java.util.Vector();
vArray.addElement("key1");
vArray.addElement("key2");
sessionScope.put('viewFilter', vArray);
For search function, We have two different ways are there. One is normal search just like OS level.And another is Full index search.
Please follow the below link, U will get better idea,
[Search Query][1]
[1]: http://www-10.lotus.com/ldd/ddwiki.nsf/dx/XPagesViewControlAddFullTextSearch.htm

How do I create an index in PostgreSQL based on lowercase only?

How would I set up an index based on lower case only?
Even though the actual field contains both upper and lower case letters.
Also, can I run a query and have only the lower case index value returned?
You can create the index and transform the field to upper- or lower-case. Then when you do your queries, you can do the same transform and it'll do the right thing.
So:
CREATE UNIQUE INDEX lower_case_username ON users ((lower(username)));
Then query for the same thing:
SELECT username FROM users WHERE lower(username) = 'bob';
According to the docs you can do this:
CREATE UNIQUE INDEX lower_title_idx ON films ((lower(title)));
You can also use this for wildcard searches:
CREATE INDEX IF NOT EXISTS foo_table_bar_field ON foo_table(lower(username))
Query like so:
SELECT * FROM foo_table WHERE lower(username) like 'bob%'
CREATE UNIQUE INDEX my_index_name ON my_table (LOWER(my_field));

Resources