case-insensitive

Java Lucene 4.5 how to search by case insensitive

别来无恙 提交于 2019-11-28 01:25:16
问题 We have implemented Java Lucene search engine 4.5, I am trying to search the content even if the field value is case insensitive (e.g., if I search a city with name "Banglore" I get a result, but when I search a city with name "banglore" I get 0 results). I have used StandardAnalyzer for analyzing the data and WildcardQuery to match a Like condition (I tried as mentioned here without success). I am not sure where I have gone wrong. I appreciate any guidance on fixing this case sensitivity

Case insensitive matching in Java switch-case statement

余生颓废 提交于 2019-11-28 00:47:21
I was wondering if there is a way to perform case insensitive match in java switch case statement. the default implementation is case sensitive . Please see the example below. public class SwitchCaseTest { /** * @param args */ public static void main(String[] args) { switch ("UPPER") { case "upper" : System.out.println("true"); break; default: System.out.println("false"); break; } } } So above statement returns false as output. And i am trying make it work for case-insensitive match like String.equalsIgnoreCase() would do. I tried to convert both the string literal to lower case and then

GSON: How to get a case insensitive element from Json?

谁说胖子不能爱 提交于 2019-11-27 23:39:19
Code shown below works well when JSON object contains jsonKey as it was passed to the method. I wonder ... if there is a way to get a value assigned to a case insensitive representation of a key? Example: public String getOutputEventDescription(JsonElement outputEvent) throws ParserException { return retrieveString(outputEvent, DESCRIPTION); } Should work regardless whether DESCRIPTION is defined as "Description", "description" or "DeScRipTIOn" protected String retrieveString(JsonElement e, String jsonKey) throws ParserException { JsonElement value = e.getAsJsonObject().get(jsonKey); if (value

SOLR Case Insensitive Search

China☆狼群 提交于 2019-11-27 21:14:29
问题 I've a problem in SOLR Search. I have a data like this: I use solr admin to find this data using query like this: address_s:*Nadi* and found those data. But when I use this query: address_s:*nadi* it doesn't found anything. I've googling and I found an answer to create a field with the following script: <fieldType name="c_text" class="solr.TextField"> <analyzer type="index"> <tokenizer class="solr.WhitespaceTokenizerFactory"/> <filter class="solr.LowerCaseFilterFactory"/> </analyzer>

MongoDB and C#: Case insensitive search

流过昼夜 提交于 2019-11-27 20:24:35
I am using MongoDB and the C# driver for MongoDB . I recently discovered that all queries in MongoDB are case-sensitive. How can I make a case-insensitive search? I found one way to do this: Query.Matches( "FirstName", BsonRegularExpression.Create(new Regex(searchKey,RegexOptions.IgnoreCase))); The simplest and safest way to do that is using Linq : var names = namesCollection.AsQueryable().Where(name => name.FirstName.ToLower().Contains("hamster")); As explained in the tutorial ToLower , ToLowerInvariant , ToUpper and ToUpperInvariant all perform matches in a case insensitive way. After that

How to create a case insensitive copy of a string field in SOLR?

此生再无相见时 提交于 2019-11-27 20:05:39
问题 How can I create a copy of a string field in case insensitive form? I want to use the typical "string" type and a case insensitive type. The types are defined like so: <fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true" /> <!-- A Case insensitive version of string type --> <fieldType name="string_ci" class="solr.StrField" sortMissingLast="true" omitNorms="true"> <analyzer type="index"> <tokenizer class="solr.KeywordTokenizerFactory"/> <filter class="solr

Case insensitive string comparison

不羁的心 提交于 2019-11-27 19:57:28
I would like to compare two variables to see if they are the same, but I want this comparison to be case-insensitive. For example, this would be case sensitive: if($var1 == $var2){ ... } But I want this to be case insensitive, how would I approach this? This is fairly simple; you just need to call strtolower() on both variables. If you need to deal with Unicode or international character sets, you can use mb_strtolower() . Please note that other answers suggest using strcasecmp() —that function does not handle multibyte characters, so results for any UTF-8 string will be bogus. Ramon

Case insensitive search in Mongo

梦想与她 提交于 2019-11-27 19:14:18
I am using a case insensitive search in Mongo, something similar to https://stackoverflow.com/q/5500823/1028488 . ie I am using a regex with options i. But I am am having trouble restricting the regex to just that word, its performs more like a 'Like' in SQL eg: if I use query like {"SearchWord" : { '$regex' : 'win', $options: '-i' }} , it shows me results for win, window & winter. How do i restrict it to jsut show win? I tried /^win$/ but its sayin invalid Json.... Please suggest a way. Thanks in advance You can use '$regex':'^win$' or /^win$/i (notice no quote on the second one) Source here

Accent and case insensitive collation in Oracle with LIKE

为君一笑 提交于 2019-11-27 18:40:58
问题 I have found this answer useful: Accent and case insensitive COLLATE equivalent in Oracle, but my question is regarding LIKE searching with a version 9 Oracle db. I have tried a query like this: SELECT column_name FROM table_name WHERE NLSSORT(column_name, 'NLS_SORT = Latin_AI') LIKE NLSSORT('%somethingInDB%', 'NLS_SORT = Latin_AI') but no results are ever returned. I created a little Java file to test: import org.apache.commons.dbcp.BasicDataSource; import java.sql.Connection; import java

PostgreSQL: Case insensitive string comparison

≡放荡痞女 提交于 2019-11-27 18:20:16
Is there a simple ignore-case-comparison for PostgreSQL? I want to replace: SELECT id, user_name FROM users WHERE lower(email) IN (lower('adamB@a.com'), lower('eveA@b.com')); With something like: SELECT id, user_name FROM users WHERE email IGNORE_CASE_IN ('adamB@a.com', 'eveA@b.com'); The like and ilike operators work on single values (e.g. like 'adamB@a.com' ), but not on sets. First, what not to do, don't use ilike... create table y ( id serial not null, email text not null unique ); insert into y(email) values('iSteve.jobs@apple.com') ,('linus.Torvalds@linUX.com'); insert into y(email)