Menu
  • HOME
  • TAGS

sum of rows maximum and minimum is not correct. whats the issue?

c++,arrays,search

With stl, your code may be void rowSum(const int (&array)[10][10]) { int sum[10] = {0}; for(int i = 0; i < 10; ++i) { sum[i] = std::accumulate(std::begin(array[i]), std::end(array[i]), 0); } auto p = std::min_max_element(std::begin(sum), std::end(sum)); std::cout << std::endl << "Row" << std::distance(std::begin(sum), p.first) << "is minimum and having sum of"...

Treeview search results flat list

c#,search,treeview

Create a parent node that should be global to the form. so that you can use the parent node without searching the directory (folder) on the harddisk every time. lets say var directoryNode = new TreeNode(directoryInfo.Name); and add all the subsequent nodes to the directoryNode as your code already performing...

Removing date from pages not posts in search results (Wordpress)

wordpress,search,post

Change <div class="searchresultsdate"> <?php the_time('M j, Y') ?> </div> to <?php if ("page" != get_post_type()){ ?> <div class="searchresultsdate"> <?php the_time('M j, Y'); ?> </div> <?php } ?> Also you're missing ';' in many places. ...

An algorithm to search for words in an array of letters

java,arrays,algorithm,search

The standard solution to your problem is to use the Aho-Corasick string matching algorithm, which builds an automaton from the dictionary and then can quickly find all words in a string that you pass to it. A Google search reveals many Java implementations. Building the automaton is O(n), where n...

Highlight text that matches a search string in Qt5

c++,qt,search

Essentially, I found that getting the QTableView to display rich text was a common use case that people on forums were trying to accomplish. Since this was a solved problem, I tried to see how I could leverage HTML. First, I set up my custom delegate to handle rich text....

AJAX Search System with spaces not working

javascript,php,ajax,search

You should encode the querystring to make it valid for URL's var qu = encodeURIComponent( $("#a-j-search-term").val() ); var page = encodeURIComponent( this.className ); $("#ress").load("funcs/func_search.php?page=" + page + "&q=" + qu, hideLoader1); or let jQuery handle it $("#ress").load("funcs/func_search.php", { page : this.className, q : qu }, hideLoader1); ...

Understanding Apache Lucene's scoring algorithm

search,solr,lucene,full-text-search,hibernate-search

Scoring calculation is something really complex. Here, you have to begin with the primal equation: score(q,d) = coord(q,d) · queryNorm(q) · ∑ ( tf(t in d) · idf(t)2 · t.getBoost() · norm(t,d) ) As you said, you have tf which means term frequency and its value is the squareroot of...

RegEx Search Pattern for ASP controls with a specific element

c#,asp.net,regex,visual-studio,search

You could search for this: (<asp:[^>]+CssClass=")checkbox_CSS("[^>]+>) And replace with this (where "new_class" is the new value for the CssClass attribute): $1new_class$2 (Demo)...

Speech recognition result handler always runs a single action

c#,variables,search,if-statement,speech-recognition

Remove ";" symbol in the end of this line if (e.Result.Text.StartsWith("google")) ; it means to end the if case right away, so the if body is void and the rest is always executed....

search and sorting in c program?

c,arrays,sorting,search,bubble-sort

You had several compilation errors, below I rewrote your code with comments so that it can compile. The actual functions seem to work just fine The most important change was passing array to both functions. It is passed as int* so that the functions can modify array in the context...

Searching for a sentence in a file java [closed]

java,file,search

You can always use the String#contains() method to search for substrings. Here, we will read each line in the file one by one, and check for a string match. If a match is found, we will stop reading the file and print Match is found! package com.adi.search.string; import java.io.*; import...

Mysql Fulltext search returns empty result while there are 100+ rows

mysql,search,full-text-search

To answer your first situation i.e. hello returing nothing, its the fulltext search stopwords which is not doing anything when you search for the word hello http://dev.mysql.com/doc/refman/5.6/en/fulltext-stopwords.html You can setup your own file as In the mysql config file , for debian /etc/mysql/my.cnf add ft_stopword_file='path/to/stopword_file.txt' We can leave this file...

solution search engine website php [closed]

php,file,search,website

There are a bunch of solutions (e.g. do you want to index your files periodically of do you prefer ad hoc searches?). Look up XML parsing and PDF parsing.

How to search for overloaded methods in a class

java,eclipse,search,ide,signature

Updated post. Old version removed You can use Reflection. I don't know your exact needs but this one works fine for my projects here is git test project : You will need to use 'org.reflections:reflections:0.9.10' lib for this. Can download from here https://code.google.com/p/reflections/ public static class MethodInfo { Class fromClass;...

Doing a multi-column search for an item in a listView control using c#

c#,linq,listview,search

Yes, it can be done, you are using the multi-column listView control, which i assume would have a data source like datatable. Which would contains Columns / Rows which would be rendered in the control. You can easily use Linq to achieve the result, something like: dataTable.AsEnumerable .Where(x=>x["NAME"] == "Fred")...

Better Search box for wordpress

wordpress,search,wordpress-plugin,wordpress-theming

Hi There it work like this using bootstrap modal popup. <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"/> <!-- Button trigger modal --> <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal"> Search </button>...

Programmatically accessing arbitrarily deeply-nested values in a dictionary [duplicate]

python,search,dictionary

One approach is to write a function to access keys in nested dicts. def deep_access(x,keylist): val = x for key in keylist: val = val[key] return val s = 'key2.key21.key211' print deep_access(x,s.split('.')) result: value211 Another approach, if you want to use similar syntax as a normal dictionary access you could...

Get Order Details by Order Id

magento,search,order,magento-1.9

In magento every order has two IDs Order ID - is Magento internal order ID Order Increment ID - is the ID display on communicate (email, etc) with your customer See Confusion with order id, order increment id and I am not getting order id as 20001201 To load order...

Angular JS filters working unexpectedly?

javascript,angularjs,search

You should put true (which is exact check) after a filter criteria, not at the 1st place of filter. Markup <li ng-repeat="x in names | filter : {id: 7}: true "> {{x.Name+ " " + x.Quote}} </li> Syntax {{ filter_expression | filter : expression : comparator}} ...

Efficient MySQL text search

php,mysql,search,sql-like

An index on the column will help, even using the like operator, but not when you have a wildcard at the start too. So for term% an index will be beneficial, but for %term% it will not. But instead, you may have a look at FULLTEXT indexes. If you add...

CoreSpotlight indexing not working

ios,swift,search,ios9,corespotlight

Try use itemContentType initializer like so : let atset:CSSearchableItemAttributeSet = CSSearchableItemAttributeSet(itemContentType: kUTTypeImage as String) atset.title = "Simple title" atset.contentDescription = "Simple twitter search" let item = CSSearchableItem(uniqueIdentifier: "id1", domainIdentifier: "com.shrikar.twitter.search", attributeSet: atset) CSSearchableIndex.defaultSearchableIndex().indexSearchableItems([item]) { (error) -> Void in print("Indexed") } The kUTTypeImage is declared in MobileCoreServices....

TermSuggestionBuilder Java API in elasticsearch does not return any results

exception,search,elasticsearch

Your implementation in java api is not valid, I've refactored your code as, SuggestBuilder.SuggestionBuilder suggestBuilder = new TermSuggestionBuilder("my-suggestion") .text("plabel").field("pzInsKey").suggestMode("always"); SuggestRequestBuilder requestBuilder = client.prepareSuggest("rule") .addSuggestion(suggestBuilder); I've not checked the output, but should work....

How to find number of elements greater/smaller than an element in an array?

c,arrays,algorithm,performance,search

A simple approach will be: Sort the array first, possibly using qsort() Perform a binary search on the sorted array. Calculate the remaining elements from the desired elements, based on the size of the array. ...

VB.Net - How to dynamicaly search for a string in all TreeView nodes expanding and collapsing nodes matching (or not) the search string?

vb.net,search,treeview,collapse,expand

Following my initial comments, try something like: Private Sub txtFiltroIDs_TextChanged(sender As Object, e As EventArgs) Handles txtFilterToolIDs.TextChanged tviewToolIDs.BeginUpdate() tviewToolIDs.CollapseAll() ClearBackColor() FindByText() tviewToolIDs.EndUpdate() tviewToolIDs.Refresh() End Sub ...

grep first n rows, return file name only

regex,linux,search,grep

You can do: for file in *.xml; do head -200 "$file" | grep -q "mysearchstring" && echo "$file" done ...

How can i search multiple words in a file on Notepad++

search,notepad++

Prolog To help people coming from the search or Google, I write it again as answer. Please mark it as correct answer to improve the speed of finding the correct answer. You can also check the comment section inside the question if something is unclear. Solution Instead of seperating the...

Swift ios relational picker views and apple dev guidelines

ios,xcode,swift,uitableview,search

Just a rough sketch: Say you pick a category from you PickerView. Your PickerView should then notify you parent ViewController that the user has picked a Category. The most convenient way to do this is to have a Delegate method, like: self.delegate.userPickedCategory(pickedCategory: Category) Now, I assume you Category object contains...

Copy cell J1 from multiple files and paste into column of master file

excel,vba,excel-vba,search,copy

objFile.Activate is your issue. objFile is not a workbook variable, it's being assigned a path\filename from objFolder.Files. Use the following: Dim NewWorkbook as Workbook set NewWorkbook = Workbooks.Open Filename:=MyFolder & objFile.Name . . . NewWorkbook.Activate ActiveWorkbook.Close Now, instead of the last two lines, since you have a variable that's referencing...

Find 2d array inside a 3d array

python,arrays,search,numpy

Using argwhere() is a good idea, but you also need to use all() to get your desired output: >>> np.argwhere((arr == [0, 4]).all(axis=2)) array([[0, 3], [0, 4], [1, 5], [1, 6], [1, 7], [2, 5], [2, 6]]) Here all() is used to check each row is [True, True] following the...

Show / Hide divs based on search.keypress (filter)

javascript,jquery,html,search,filter

This can be achieved by delaying the event by about 10ms, the user won't notice a difference, but it'll help you on your side. I made a fiddle for your problem. Here's what it basically does: $(function () { var input = $("#entry"); input.keydown(function () { // doesn't matter if...

If Input is focused trigger X else trigger Y

javascript,jquery,search,input

Use .focus() and .blur() like this instead $('input#edit-keys-2').on("focus", function(){ $('#zone-header ul#nice-menu-1').animate({opacity:0}, 300); }).on("blur", function(){ $('#zone-header ul#nice-menu-1').animate({opacity:1}, 300); }); $('input#edit-keys-2').on("focus", function(){ $('#nice-menu-1').animate({opacity:0}, 300); }).on("blur", function(){ $('#nice-menu-1').animate({opacity:1}, 300); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <input type="text"...

Images not visible in search results

php,wordpress,image,search,advanced-custom-fields

Try for the thumbnail: $imgsrc = wp_get_attachment_image_src(get_post_thumbnail_id( $post_id )); echo $imgsrc[0]; Edit, use this code with the attachment id: $imgsrc = wp_get_attachment_image_src(get_field('foto', $postid)); echo $imgsrc[0]; ...

Search for more than one element in a list in Cassandra

search,cassandra,cql3

Secondary indexes are generally not recommended for performance reasons. Generally, in Cassandra, Query based modelling should be followed. So, That would mean another table: CREATE TABLE friend_group_relation ( friend VARCHAR, group_id int, <user if needed> PRIMARY KEY ((friend), group_id) ); Now you can use either IN query (not recommended) or...

Android SQLite Like query

sqlite,search,like

The % wildcards must be part of the string: ... + " LIKE '%" + strname+ "%'", ... Please note that this code will blow up when the string contains a quote. You should use parameters instead: db.query(true, DATABASE_TABLE, new String[] {KEY_ROWID,KEY_FAULTREF,KEY_WORKNUM,KEY_ORIGNUM,KEY_REPBY,KEY_REPDATTIM,KEY_DESCRIPTION}, KEY_REPBY + " LIKE ?", new String[] {...

(Java) Having trouble with recursive overloading

java,arrays,search,recursion

I fixed the code. Essentially I'd been going about the problem all wrong: I was missing a case check. What I mean is that there are four possible outcomes for each subsequent recursion of the method: The end of the array has been reached and the returned value should be...

Using StringComparer with StringBuilder to search for a string

c#,string,search,stringbuilder,culture

So why not copy the whole document to a stringbuilder first, the use 1 ToString(). Then just use a similar scheme to iterate over all the possible values. Use compareInfo.Compare(criteria.Text, 0, criteria.Text.Length, docString, startIndex, checkLength)

JQuery And JavaScript Search AutoComplete

javascript,jquery,search,input,autocomplete

The autocomplete function you are using is from jqueryUI.Have you included it?

Pagination with PDO MySQL Search Multiple Form Fields

php,mysql,search,pdo,pagination

Your field_oem_value and field_oem_pn_value params are getting lost after clicking on any of the pagination links. You need to specify them explicitly in link's href (or save in session). Do something like this: $params = [ 'field_oem_value' => $oemSearch, 'field_oem_pn_value' => $oempnSearch ]; // The "back" link $prevlink = ($page...

Elasticsearch partial producttype names

search,elasticsearch,partial

You can use prefix query which performs better than wildcard queries. For this you need to make your field not analyzed as below "type_name": {"type": "string", "index": "not_analyzed"} Another way could be to use the edge ngram tokenizer which may increase your index size but will give a better performance....

Search box/field design with multiple search locations

python,search,design,search-engine,pyramid

What happens to your search interface if the application changes? This is a very important aspect. Do you add another search type? A search returns matches on the query string. A result set can contain different entities from different types. Then your search/resultset interface could apply filtering based on entity...

How to index plain text files for search in Sphinx

search,sphinx,plaintext

Have a look at this before proceeding Sphinx without SQL! . Ideally I would do this. We are going to use Sphinx's sql_file_field to index a table with file path. Here is the PHP script to create a table with file path for a particular directory(scandir). <?php $con = mysqli_connect("localhost","root","password","database");...

Search code in C# .NET MVC is not working

c#,asp.net-mvc,search

Why don't you try filtering for the object immediately? Also, I'm not sure why you have a second set of curly braces. If the MedsEntities function is a DataContext type, I believe when you are passing lolo to the View, it is still a Queryable. Maybe try this: public ActionResult...

T SQL wildcard searching for a zip code

sql,search,wildcard

If what you said is true, that @MailFiveDigitZip is a char and not a varchar, then you're running into character padding issues. "44" in a varchar(5) is "44" "44" in a char(5) is "44 " (note in case it doesn't translate well... this is 44 plus 3 spaces) like "44...

How can I add custom search engine to browser?

search,browser,manifest,provider

A couple of steps. First, create an XML file with the information for the search provider. This is an example for Wikipedia: (Named: Wikipedia.xml) <?xml version="1.0" encoding="UTF-8"?> <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"> <ShortName>Wikipedia</ShortName> <Description>Wikipedia Search</Description> <InputEncoding>UTF-8</InputEncoding> <Url type="text/html" template="http://en.wikipedia.org/w/index.php?title={searchTerms}" />...

How to search in ArrayList of Custom Objects and then Update ListView with results?

java,android,listview,search,arraylist

You need to update the Adapter that you are using to to populate the ListView. edittext.setOnEditorActionListener(new OnEditorActionListener() { @Override public boolean onEditorAction(TextView arg0, int arg1, KeyEvent arg2) { //I will store the matches on this list. List<Medico> resultado = new ArrayLisy<Medico>(); int searchListLength = medicos.size(); for (int i = 0;...

How do I make a query search in rails case insensitive?

ruby-on-rails,postgresql,ruby-on-rails-4,search

Because you are using postgresql: def self.search(query) where("description ilike ?", "%#{query}%") end Just use ilike instead of like. like/ilike documentation If you want to use =, both sides either UPPER or LOWER...

SQL weight rows by formula

php,mysql,sql,search,laravel-5

A single case expression is much simpler: select `name`, `id`, `city`, `country`, `avatar`, (CASE WHEN users.city = 'Cluj Napoca' THEN 4 WHEN users.state = 'Cluj' THEN 3 WHEN users.country = 'Romainia' THEN 2 ELSE 1 END) AS score from `users` where `name` LIKE ? order by `score` desc EDIT: If...

Recursive solution doesn't iterate correctly

ruby,algorithm,search,recursion

The first time you enter the adjacencies[to_append].each, you immediately return from the method, therefore the loop will never be executed more than once. You need to return a list of phone numbers instead of just a single phone number build that list somehow in your recursive call ...

How to make Search Dialog size of a toolbar

android,search,layout,toolbar,search-dialog

You can use a SearchView instead of a Search dialog, it is more flexible and it can be easily embedded into a xml menu, and it will fit the height of the action bar, try this: <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" > <item android:id="@+id/menu_search" android:icon="@drawable/ic_action_search" android:title="@string/desc_search" app:actionViewClass="android.support.v7.widget.SearchView" app:showAsAction="ifRoom|collapseActionView"/> </menu>...

VBA through Internet Explorer, Find String of Text and Use It

vba,excel-vba,search

Dim links, link Dim dict As Object '------------------------- 'get to the right page... '------------------------- Set dict = CreateObject("scripting.dictionary") 'collect the player links Set links = IE.document.getElementsByTagName("a") For Each link In links If link.href Like "*/Popups/PlayerProfile.aspx?pid=*" Then dict.Add link.innerText, link.href End If Next link 'navigate to each page and collect info...

Search Multiple directories and return one result

linux,search,aix

You could try the following command and then query the status code $?: find $FolderPath -name 'FileName.txt' | grep -E '*' This returns 1 when there are no files listed by the find command and 0 when there are. Optionally, if you're only interested in hitting a specific level to...

How to make a big form?

php,search

For searching you can use MATCH (something) AGAINST ('some words' IN BOOLEAN MODE) ...

KQL - Ignoring items with property not equal to value

search,sharepoint-2013

So I think I figured it out. I'd have to white two queries combined like this: (ContentTypeId: 'ContentType that has ModerationStatus' ModerationStatus <> 1) OR (ContentTypeId <> 'ContentType that has ModerationStatus') I apologize for the dumb question....

Laravel Search Relations whereHas

laravel,search

You have to call get() to get the data. And I think this will be more readable code. public function search() { $search = Input::get('search'); $result = Products::where('name', 'LIKE', '%'. $search .'%')->get(); if ($result->first()) { $categories = Categories::with('product')->orderBy('name', 'asc') ->whereHas('product', function($query) use ($search){ $query->where('name', 'LIKE', '%'.$search.'%'); })->get(); return View::make('groceries.index') ->with('categories',...

Parse filterResults findObjects vs findObjectsInBackgroundWithBlock

ios,objective-c,uitableview,search,parse.com

In the first case, the query runs on the main thread, so the program waits until the query returns before continuing. This is less than ideal, since your app could halt for an indeterminate amount of time until the query returns - hence the warning message. The second case is...

numpy search array for multiple values, and returns their indices

arrays,python-3.x,search,numpy

A classic way of checking one array against another is adjust the shape and use '==': In [250]: arr==query[:,None] Out[250]: array([[False, False, False, False, False, True], [False, True, False, False, False, False], [ True, False, False, False, False, False]], dtype=bool) In [251]: np.where(arr==query[:,None]) Out[251]: (array([0, 1, 2]), array([5, 1, 0]))...

Elasticsearch - cleaning but no analyzer

search,elasticsearch

I think you can get what you want with the keyword tokenizer and the lowercase filter. I'll give you a simple example. I set up an index like this, with a custom analyzer: PUT /test_index { "settings": { "number_of_shards": 1, "analysis": { "analyzer": { "my_analyzer": { "type": "custom", "tokenizer": "keyword",...

Assigning value to Search Bar Delegate - Swift

ios,swift,uitableview,search

There is no problem with the use of tableView as both a local (to a function) and "global" variable name. If you have a local and a global variable with the same name, the code will access the local variable in preference to the global. If you want to access...

Print index table with prawn ruby on rails

ruby,ruby-on-rails-4,search,params,prawn

I solved it by passing the search param through the link to method like so: <%= link_to "appointments of the day", citas_del_dia_appointments_path(@appointments, :format => 'pdf', :search => params[:search]), target: "_blank" %> now it works like a charm...

Hide soft keyboard in android after using library

android,search,android-softkeyboard

Call this method from Activity where you want to hide soft keyboard (you can put it in to diffetent class & call using class name as its static) public static void hideSoftKeyboard(Activity activity) { InputMethodManager inputMethodManager = (InputMethodManager) activity .getSystemService(Activity.INPUT_METHOD_SERVICE); if (activity.getCurrentFocus() != null) inputMethodManager.hideSoftInputFromWindow(activity .getCurrentFocus().getWindowToken(), 0); } ...

SQL find same value on multiple filelds with like operator

mysql,sql,search,like,sql-like

You are using the LIKE operator for first_name and last_name as follows: LIKE '%Natalie Fern%' This will only match strings which contain anything followed by 'Natalie Fern' followed by anything. But since the first and last name columns only contain (surprise) the first and last names, your query isn't matching...

Searching a TextField and IntField together seperated by an AND condition In Lucene

java,search,indexing,lucene

There are a few possibilities. First, what I would most recommend in this case, is perhaps you don't need those IntFields at all. Zip codes and IDs are usually not treated as numbers. They are identifiers that happen to be comprised of digits. If your zip code is 23456, that...

Sql string search

sql,string,search,select

Not sure what you're trying to do with the NULL there, but basically you if you want to find a capital that contains the name of the country, the usage of the like operator is definitely in order. Just slap a couple of wildcards (%) around it, and you should...

How do I create a url in django and capture inputs for a search page?

python,django,search

You said yourself that the URL is "/myapp/search/", but the "action" parameter of your form - which determines where the form data is sent - is just "/search/". You need to make it the same, so that the data is sent to that URL. The best way to do it...

searching in list getting true infinitely in prolog

list,search,prolog

a) You have a dot that must be comma in: collision(X,Y):- member(X,GroupA),member(Y,GroupA). member(X,GroupB),member(Y,GroupB). b) Better you do not redefine "member", it is standard. c) If I change dot by comma in: collision(X,Y):- GroupA(L),member(X,L),member(Y,L), GroupB(L),member(X,L),member(Y,L). this statement will fail always because there are no list "L" common to GroupA and GroupB....

trying to extract a string from a js this keyword

javascript,search,this

When you are in the event handler this points to the clicked link. There is no search method for an element. Probably you are trying to search for a string somewhere in the link, maybe the content. $('body').on("click", 'a', function (evt) { evt.preventDefault(); console.log(this); $('.content').addClass('hide'); if (this.innerHTML.search("AV") > 0) {...

What indexer do I use to find the list in the collection that is most similar to my list?

search,indexing,solr,levenshtein-distance

I wonder what keeps you from trying it with Solr, as Solr provides much of what you need. You can declare the field as type="string" multiValued="true and save each list item as a value. Then, when querying, you specify each of the items in the list to look for as...

MYSQL - Selecting rows with more than 1 LIKE

search,mysqli,like

You could try using REGEXP as said by @jazkat at Mysql Like multiple values Your query would be: SELECT * FROM table WHERE column REGEXP "The long lasting i don't know|The|long|lasting|i|don't|know" More about REGEXP here: http://www.tutorialspoint.com/mysql/mysql-regexps.htm...

places not found using google places api in iOS

ios,search,google-places-api

Enable to this api Google Places API Web Service & Google Places API for iOS in the APIs Console Refer to this document.... Google Places API Web Service https://developers.google.com/places/webservice/search...

Binary search implementations

python,algorithm,search

You could use a generator: def chopper(array, val): edges = (0, len(array)) while True: m = sum(edges)/2 edges = (edges[0], m) if array[m] >= val else (m+1, edges[1]) yield edges def chopSearch(array, val): for l, r in chopper(array, val): if array[l] == val: return l if l==r: return -1 ...

PHP sum echo result on the fly (difficult)

php,html,mysql,forms,search

Muy bien, maradoiano, tuve que realizar algunas acrobacias para correr tu código, la cosa está así: Para obtener la suma de todas las inversiones sencillamente se necesita una variable que acumule los resultados de todos los (costo * stock), llamémosla $total. Para desplegar este total ARRIBA de la tabla es...

Elasticsearch Facet List doesn't Match Results

ruby-on-rails,ruby,search,elasticsearch,elastic

This is the normal behavior of facets when ran against a filter. From the official documentation: There’s one important distinction to keep in mind. While search queries restrict both the returned documents and facet counts, search filters restrict only returned documents — but not facet counts. In your case, your...

How to include more search items

ios,xcode,search,bundle

You can't do much about it since the spotlight's search mechanism is built-in in iOS. When user types a keyword, iOS will search the following two names of all installed apps: The app's bundle display name (the name used in your home screen). The (usually) longer name used in the...

Apache Solr Exception

php,apache,search,drupal,solr

When Solr starts and the index folder doesn't exists Solr create it by itself. To make it possible the folder be created by tomcat user this user need to have permission to create the folder. If the tomcat user doesn't have permission to create the index folder an exception is...

Search a string without . character

c#,linq,search,directory

So you want to ignore the dots and the extension of the file-name? You could use String.Replace to remove the dots, a loop or LINQ query and the Path-class: string searchFileNoExt = Path.GetFileNameWithoutExtension("1346670589521421983450911196954093762922.nii"); var filesToProcess = Directory.EnumerateFiles(rootDir, ".*.", System.IO.SearchOption.AllDirectories) .Where(fn => Path.GetFileNameWithoutExtension(fn).Replace(".", "").Equals(searchFileNoExt, StringComparison.InvariantCultureIgnoreCase)); foreach (string file in filesToProcess)...

find common string in two text files using batch script

string,parsing,batch-file,search,replace

Not sure about the requirements, but, maybe awk "{print $1}" 2.txt | findstr /g:/ /l /b 1.txt Without awk cmd /q /c"(for /f "usebackq" %%a in ("2.txt") do echo(%%a)" | findstr /g:/ /l /b 1.txt Only awk awk "{a[$1]=!a[$1]} !a[$1]" 2.txt 1.txt ...

Searching for content between non-tag strings

python,search

You need to use q.find to end1 instead of rfind for first sub-string and rfind for last one: >>> q[q.find(start1)+len(start1):q.find(end1)] 'content_of_interest_1' >>> q[q.rfind(start1)+len(start1):q.rfind(end1)] ':content_of_interest_2' But using find will give you just the index of first occurrence of start and end. So as a more proper way fro such tasks you...

PHP/mySQL results not being displayed [duplicate]

php,mysql,search,result

Firstly don't use the mysql API it is deprecated use PDO or mysqli. Secondly Check $result before passing it to mysql_fetch_array. You'll find that it's false because the query failed. See the mysql_query documentation for possible return values and suggestions for how to deal with them. <?php if (isset($_POST['submit'])) {...

SQL statement search for all characters inside field

sql,search,like

The % sign you attach to your parameter acts as an SQL wildcard: $search_query = $query.'%'; Since you only attach it to the end of your parameter, it will only search for the string in the beginning of the column values. Instead, also add one in the beginning of your...

Postgres full text search: how to search multiple words in multiple fields?

sql,postgresql,search,indexing,full-text-search

It looks like what you want is, in fact to search the concatenation of all those fields. You could build a query doing exactly this ... where to_tsvector('italian', name||' '||coalesce(decription,'')...) @@ to_tsquery('$word') and build an index on the exact same computation: create index your_index on shop using GIN(to_tsvector('italian',name||' '||coalesce(decription,'')...)) Don't...

Change input value when i press Attribute

php,forms,search,onclick,submit

in your js file you can check if the value of the textbox is equal to the cityname you want. if it is then submit the form. Attach the function to your a tag function SubmitRightCity(){ if(document.getElementById('search').value == "citynamehere"){ document.forms["form"].submit(); } } in html <a onClick="submitRightCity()">City</a> In the case where...

If statement for search field in Rails

jquery,ruby-on-rails,search,if-statement

The standard way to use a search would be to include a parameter in the URL. That way you can have a similar to if user_signed_in? check for the parameter: if params[:search].present?.

Using two different templates for search results - Haystack

templates,search,django-haystack

Here is how I would do it: First, create a search form that inherits haystack's SearchForm: class ItemSearchForm(SearchForm): def search(self, request): items = super(ItemSearchForm, self).search().models(Item) // Item is your model name shops = super(ItemSearchForm, self).search().models(Shop) return {'items': items, 'shops': shops} Second, create views that uses this form: def searchItems(request): form...

Tree searching algorithm

string,algorithm,search,graph,tree

It's an interesting problem; usually one would imagine a single tree being searched for a variable set of strings. Here the situation is reversed: the set of strings is fixed and the tree is highly variable. I think that the best you can do is build a trie representing the...

How to efficiently select neighbour in 1-dimensional and n-dimensional space for Simulated Annealing

java,algorithm,search,optimization,simulated-annealing

So you are trying to find an n-dimensional point P' that is "randomly" near another n-dimensional point P; for example, at distance T. (Since this is simulated annealing, I assume that you will be decrementing T once in a while). This could work: double[] displacement(double t, int dimension, Random r)...

Vim Statusline: Word search

search,vim,statusline

The first thing to mention here is that for large files this feature would be completely impractical. The reason is that the status line is redrawn after every cursor movement, after the completion of every command, and probably following other events that I am not even aware of. Performing a...

Adding table and style to php echo code [closed]

php,css,table,search

Instead if <div> tags, you need to use <td> tags inside <tr> in table: echo"<div class='results'> <table border='2' style='background-color:#FFFFFF;border-collapse:collapse;border:2px solid #6699FF;color:#000000;width:400'> <tr> <td class='title'><a href='$url'><b>$title</b></a></td> <td class='url'><font color='green' size='2'>$url</font></td> <td class='desc'>$desc</td> </tr> </table> </div>"; ...

Can anyone help me make the search bar work as I now have the JS prompt? [on hold]

javascript,html5,search,youtube-api,search-engine

You can just add an onclick listener to the find button and trigger the code when someone clicks. You can get the value of the search input instead of the prompt: Javascript: function search() { var api_key; api_key = "AIzaSyDiUEkwoldcB9qgRreOsaiyu2Nlj8U-03c"; var search_term = document.getElementById("searchterm").value; function onSuccess(data){ console.log(data); var obj =...

Creating filtering by 'Created_at' and/or presence of data in multiple columns

ruby-on-rails,search,filter

scopes are great in ruby. http://apidock.com/rails/ActiveRecord/NamedScope/ClassMethods/scope if you want to filter by a certain date. Say you want everything that is supposed to happen after today you do the following. Put a scope definition like this in the model you want to scope. Lets call it Mimodel scope :post_dated, where("created_at...

Elasticsearch advanced search

ruby-on-rails,ruby,search

I will prefer to do this in your action. tags = params[:q].present? ? params[:q].scan(/#[^ #]+/).collect{|tag| tag.gsub(/#/, '')} : [] now you can use this array of tags in search function...

Search barre php+mysql “Page not found”

php,mysql,search,prepared-statement

Seems like in <td><input name="name" type="text" /></td> name isn't a appropriate variable name.... When i'm changing to nam it works. I'm sorry for writing an other useless question... But it's like each time the same... I'm stuck for hours trying to correct my stuff, I surrender and ask here. And...

C - Print Specific Line From Text File

c,file,search

gets should be replaced to avoid buffer overflow I have used some define, when we find the word the input line is dup and print at the end. File is read line by line, each line is split word by word. Parsing should be updated, allows several spaces for example,...

Vim: How to search for more than one word in the same search?

search,vim

Yes, you can have several branches in a search pattern: /foo\|bar See :help \|....

Is it possible to search all columns through MySQL table in PHP query, without typing out each column name?

php,mysql,search,like

Note that you can probably achieve something like this in your favorite mysql frontend, I use sqlyog and you can do that with the "data search" tool, I'm sure other software like mysql workbench has a similar option. Anyway, you can have php construct the query for you. Get all...

How to skip a row with file exists condition in laravel

laravel,search,eloquent

Option 1: would be to make an array of the filenames, then utilize the whereIn query builder method, which checks for the occurrence of a column value in an array. $query = Model::query(); $filenames = scandir('/img'); // the following excludes any id's not in the $filenames array $query = $query->whereIn('id',...

unindexed field in appengine search document?

google-app-engine,search

No, the full text search service is a search index, not a data repository, so by definition everything is indexed. You would probably struggle with this approach because the data types you put in are not necessarily what are stored, for example dates put in only have precision of a...