search

PHP - Open or copy a file when knowing only part of its name?

☆樱花仙子☆ 提交于 2021-02-20 04:40:47
问题 I have a huge repository of files that are ordered by numbered folders. In each folder is a file which starts with a unique number then an unknown string of characters. Given the unique number how can i open or copy this file? for example: I have been given the number '7656875' and nothing more. I need to interact with a file called '\server\7656800\7656875 foobar 2x4'. how can i achieve this using PHP? 回答1: If you know the directory name, consider using glob() $matches = glob('./server/dir/'

searching a jquery datatables

霸气de小男生 提交于 2021-02-20 02:57:26
问题 I am using jquery datatables 1.10 and trying to search and filter a table. I would like to use a search text box that searches two columns and a check box to filter the results of a third column. Here is my datatable: var url = '@Url.Action("SupportClass1Search", "SupportClass1")'; $('#SupportClass1DataTable').DataTable({ "serverSide": true, "processing": true, "ajax": url, "ordering": true, "dom": '<"top"prl<"clear">>t<"bottom">pi<"clear">', "pageLength": 10, "autoWidth": false, "columns": [

How to build a custom expression for an advanced search screen

≡放荡痞女 提交于 2021-02-19 06:48:11
问题 I am building an advanced search screen and am using nHibernate to query the DB. I have already built my DataAccess layer and have built a generic method which works great - I pass in an expression to be used as a predicate and passes back a collection of an object that matches the predicate: public object LoadByPredicate<T>(Expression<Func<T, bool>> predicate) where T : class Example usage is: var items = _query.LoadByPredicate<StaticTypes>(x => x.StaticName == type) as List<StaticTypes>;

Azure Search - Accent insensitive analyzer not working when sorting

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-19 05:27:37
问题 I'm using Azure Search. I have a model with a property with this attributes [IsRetrievable(true), IsSearchable, IsSortable, Analyzer("standardasciifolding.lucene")] public string Title { get; set; } I want the search to be accent insensitive. Although it is working when searching/filtering, it is not working when sorting the results. So, If I have words that start with an accent and I sort alphabetically, those results appear at the end of the list. 回答1: I verified your use case by creating

Azure Search - Accent insensitive analyzer not working when sorting

吃可爱长大的小学妹 提交于 2021-02-19 05:27:33
问题 I'm using Azure Search. I have a model with a property with this attributes [IsRetrievable(true), IsSearchable, IsSortable, Analyzer("standardasciifolding.lucene")] public string Title { get; set; } I want the search to be accent insensitive. Although it is working when searching/filtering, it is not working when sorting the results. So, If I have words that start with an accent and I sort alphabetically, those results appear at the end of the list. 回答1: I verified your use case by creating

How do I SQL query for words with punctuation in Postgresql?

情到浓时终转凉″ 提交于 2021-02-18 22:45:23
问题 If I have strings/phrases like this stored in the database: What are Q-type Operations? Programmer's Guide A.B.C's of Coding Is there a way to pass a query parameter in like "Programmers" or "abc" or "q-type" and have it find "Programmer's" , "A.B.C" and "Q-type" ? 回答1: tsvector Use the tsvector type, which is part of the PostgreSQL text-search feature. postgres> select 'What are Q-type Operations?'::tsvector; tsvector ------------------------------------- 'Operations?' 'Q-type' 'What' 'are'

Elasticsearch sort based on the number of occurrences a string appears in an array

半世苍凉 提交于 2021-02-18 19:35:48
问题 I have an array field containig a list of strings: ie.: ["NY", "CA"] At search time I have a filter which matches any of the strings in the array. I would like to sort the results based on documents that have the most number of appearances of the searched string: "NY" Results should include: document 1: ["CA", "NY", "NY"] document 2: ["NY", FL"] document 3: ["NY", CA", "NY", "NY"] Results should be ordered as such User 3, User 1, User 2 Is this possible? If so, how? 回答1: For those curious, I

MongoDB: $or a full-text search and an $in

╄→гoц情女王★ 提交于 2021-02-18 10:43:13
问题 The problem Hi. I have what seems to me as a strange problem and I'm at a loss with it: Let's take: tags = [ ObjectId('a'), ObjectId('b') ] search = { $search: 'abc' } Now the following query works fine: db.entries.find({ $or: [ {$text:search} ] }) And this one too: db.entries.find({ $or: [ {tags:{$in:tags}} ] }) But combine them: db.entries.find({ $or: [ {$text:search}, {tags:{$in:tags}} ] }) And I get the following error: Unable to execute query: error processing query: ns=db.entries Tree:

MongoDB: $or a full-text search and an $in

别来无恙 提交于 2021-02-18 10:42:12
问题 The problem Hi. I have what seems to me as a strange problem and I'm at a loss with it: Let's take: tags = [ ObjectId('a'), ObjectId('b') ] search = { $search: 'abc' } Now the following query works fine: db.entries.find({ $or: [ {$text:search} ] }) And this one too: db.entries.find({ $or: [ {tags:{$in:tags}} ] }) But combine them: db.entries.find({ $or: [ {$text:search}, {tags:{$in:tags}} ] }) And I get the following error: Unable to execute query: error processing query: ns=db.entries Tree:

inserting in binary tree doesn't work using java

风格不统一 提交于 2021-02-17 03:05:21
问题 I'm currently learning about trees using java and i have some errors going on here in the insertion of items in a binary tree I don't why it doesn't work this is the code: tree node: public class TNode { int data; TNode left; TNode right; public TNode(int data) { this.data = data; left = null; right = null; } } tree class: public class Tree { TNode root; public Tree(){ root = null; } public TNode insertNode(TNode item, int d) { if (item == null) { return new TNode(d); } if (d < item.data) {