case-insensitive

case insensitive highlighting in php

江枫思渺然 提交于 2019-12-01 06:39:02
问题 i'm using this function to highlight the results from mysql query: function highlightWords($string, $word) { $string = str_replace($word, "<span class='highlight'>".$word."</span>", $string); /*** return the highlighted string ***/ return $string; } .... $cQuote = highlightWords(htmlspecialchars($row['cQuotes']), $search_result); the problem is, if i type in 'good', it will only show my search results with a lower-case 'g'ood and not 'Good'. how do i rectify this? 回答1: Use str_ireplace()

Solr - case-insensitive search do not work

江枫思渺然 提交于 2019-12-01 05:27:44
I want to apply case-insensitive search for field myfield in solr. I googled a bit for that , and i found that , i need to apply LowerCaseFilterFactory to Field Type and field should be of solr.TextFeild . I applied that in my schema.xml and re-index the data, then also my search seems to be case-sensitive. Below is search that i perform. http://localhost:8080/solr/select?q=myfield:"cloud university"&hl=on&hl.snippets=99&hl.fl=myfield Below is definition for field type <fieldType name="text_en_splitting" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true">

Case Insensitive searches/queries

橙三吉。 提交于 2019-12-01 05:21:56
Does anyone know how to do a Case Insensitive Search/Query with Postgres 7.4? I was thinking RegEx but not sure how to do this or maybe there is a function/flag or something I could add the the query? I'm using PHP to connect and execute the queries. So I'm looking to match address information. Example: 123 main street 123 Main st. 123 Main Street 123 main st 123 Main st etc... any thoughts? SELECT address FROM tbl WHERE address LIKE '%123 %ain%' Use ILIKE , e.g.: ... WHERE address ILIKE '123 main st%' Documentation . Alternatively you could use UPPER or LOWER , e.g.: ... WHERE LOWER(address)

Case-insensitive find_or_create_by_whatever

一笑奈何 提交于 2019-12-01 04:59:02
I want to be able to do Artist.case_insensitive_find_or_create_by_name(artist_name) [1] (and have it work on both sqlite and postgreSQL) What's the best way to accomplish this? Right now I'm just adding a method directly to the Artist class (kind of ugly, especially if I want this functionality in another class, but whatever): def self.case_insensitive_find_or_create_by_name(name) first(:conditions => ['UPPER(name) = UPPER(?)', name]) || create(:name => name) end [1]: Well, ideally it would be Artist.find_or_create_by_name(artist_name, :case_sensitive => false) , but this seems much harder to

Laravel case insensitive routes

馋奶兔 提交于 2019-12-01 04:23:26
How do I define a case insensitive (part of a) route? Example: Route::get('/{userId}/profile'); http://domain.com/123/profile works fine. Any use of uppercase in the fixed part of the route does not work: http://domain.com/123/Profile does not work http://domain.com/123/proFILE does not work I understand how I can make parameters like {parameter} use a regex pattern using ->with(), but that does not help me with the fixed part of the route, like described above. This can be solved by defining routes the following way: Route::get('/{userId}/{profile}')->with('profile', '(?i)profile(?-i)'); Even

Case Insensitive searches/queries

雨燕双飞 提交于 2019-12-01 04:09:56
问题 Does anyone know how to do a Case Insensitive Search/Query with Postgres 7.4? I was thinking RegEx but not sure how to do this or maybe there is a function/flag or something I could add the the query? I'm using PHP to connect and execute the queries. So I'm looking to match address information. Example: 123 main street 123 Main st. 123 Main Street 123 main st 123 Main st etc... any thoughts? SELECT address FROM tbl WHERE address LIKE '%123 %ain%' 回答1: Use ILIKE , e.g.: ... WHERE address ILIKE

Solr - case-insensitive search do not work

时光总嘲笑我的痴心妄想 提交于 2019-12-01 03:40:59
问题 I want to apply case-insensitive search for field myfield in solr. I googled a bit for that , and i found that , i need to apply LowerCaseFilterFactory to Field Type and field should be of solr.TextFeild . I applied that in my schema.xml and re-index the data, then also my search seems to be case-sensitive. Below is search that i perform. http://localhost:8080/solr/select?q=myfield:"cloud university"&hl=on&hl.snippets=99&hl.fl=myfield Below is definition for field type <fieldType name="text

How can I do case insensitive git diffing while also doing `git diff --color`?

£可爱£侵袭症+ 提交于 2019-12-01 02:49:11
Is it possible to do a case insensitive git diff while also doing git diff --color-words ? Or do I need to use an external diff program while doing git diff --color-words ? ( note: if all you want is git diff case insensitive please go to this question How to perform case insensitive diff in Git ) GIT_EXTERNAL_DIFF='diff -ipu "$2" "$5" #' git diff --ext-diff Or, in a nicer fashion without the # hack I used there: echo 'diff -ipu "$2" "$5"' >myscript; chmod a+x myscript; GIT_EXTERNAL_DIFF='./myscript' git diff --ext-diff I agree it would be nicest if git-diff would just have an -i option...

Case-insensitive find_or_create_by_whatever

浪尽此生 提交于 2019-12-01 01:58:38
问题 I want to be able to do Artist.case_insensitive_find_or_create_by_name(artist_name) [1] (and have it work on both sqlite and postgreSQL) What's the best way to accomplish this? Right now I'm just adding a method directly to the Artist class (kind of ugly, especially if I want this functionality in another class, but whatever): def self.case_insensitive_find_or_create_by_name(name) first(:conditions => ['UPPER(name) = UPPER(?)', name]) || create(:name => name) end [1]: Well, ideally it would

MongoDB and Java driver: “ignore case” in query

匆匆过客 提交于 2019-12-01 00:25:55
问题 This is the code I'm using now, how do I add the "ignore case" attribute? DBObject query = new BasicDBObject("prop", value); Thanks 回答1: When I had the exact problem, I wasn't able to query by ignoring case. I ended up copy the value that I wanted to search normalizing it. In this case, you can create a new property and convert it to lower case and have an index on that. EDIT: DBObject ref = new BasicDBObject(); ref.put("myfield", Pattern.compile(".*myValue.*" , Pattern.CASE_INSENSITIVE));