views – How do I set filters to reset automatically on new search?

I have a search and some filters on a drupal 7 site. If I search a term, for example “stuff”, and there are 30 results, I can click a checkbox filter (let’s call it FilterA) on the side and narrow my results down. But now if I type “things” in the search bar and submit it, FilterA is still clicked when the results come up. I need for all the filters to be unchecked when I perform a new search. I’ve gone through I feel every setting in the view and all the search and filter settings and still nothing. Thank you for any help you can provide.

wp query – How to search by a post and a category name on wordpress at the same time?

I wanna change the default behavior of wordpress search engine. Basically, I want to choose between 2 paths when the user informs a term on the search input:

  • Find the posts or custom posts that have that informed term
  • Or find the posts that belong to a taxonomy (or a custom taxonomy) that
    has a name like the informed term

So far, I’m trying to use the hook pre_get_posts but I don’t know how to combine the 2 paths. I did try something like this:

function change_posts_per_page( $query ) {
    $query->set(
        'tax_query', array(
            array(
                'taxonomy' => 'course-category',
                'field'    => 'name',
                'terms'    => get_query_var('s')
            )
    )); 
}

add_action( 'pre_get_posts', 'change_posts_per_page' );

It doesn’t bring the posts with a taxonomy that has the name get_query_var(‘s’). Can someone help me?

optimization – Given consumer grade hardware,what is a reasonable upper bound for size of search space?

There’s a gacha RPG I’m trying to get better at.

I estimate there are about 10^15 states for the 3 opening rounds of a match for which I am trying to evaluate damage output.

The equations themselves aren’t complicated: mostly linear ones, with the odd division and factorial with small integers (less then n=10) thrown in.

I’m trying to differentiate between “easy”, “tough but doable if you know what you’re doing” and “don’t even think about it”.

I suspect I’ll have to simplify the problem further, but is there a way to know at which point brute force becomes unreasonable before committing to code? I only have access to consumer grade hardware (and google colab).

google sheets – Search through multiple tabs and pull results

Test Sheet for my use case: https://docs.google.com/spreadsheets/d/1_gcyygG8IhVc-4mXf8n09IFG5ZIYuK_UxWxPLQ5av-k/edit?usp=sharing

I’ve had some input from another user on the site helping me search through one tab of data in my sheet and pull results. Now I’m wondering if its possible to do that but also look through multiple tabs.

In the “Partial Answer” tab, it shows how it would work with a single tab (‘Car Parts’) but it broke when U transferred it over to this new sheet. Besides the point, I would like the “Search Tab” tab be able to look for a keyword in ‘A2’ and return results in ‘B2:B’ from all my tabs (Hoods, Bumpers, and Doors) as well as link to the row the data was pulled from in the query in B2:

=iferror(query('Car Parts'!A2:A,"select A where upper(A) contains '"&UPPER(A2)&"' ",0), "not found")

python – How to make this DFS based exhaustive word grid search faster

I have implemented an exhaustive dfs based grid search that searches for all possible words in the 8 connected regions. Is there any way I can make this faster or memory efficient than it is now?

I feel like passing a copy of the seen set in dfs(xx, yy, seen.copy(), word + grid(x)(y)) is an overhead that can possibly be avoided.

Or is my algorithm completely wrong and I should use something else?

This is not a code site challenge, I am just trying to implement this out of curiosity.

My first question on code review so let me know if there is something that I can add to make this better.

Also can this be made more “pythonic”?

def possible_directions(x, y):
    """
    Returns at most 8 connected co-ordinates for given `x` and `y`
    """
    for xx in range(-1, 2):
        for yy in range(-1, 2):
            if not xx and not yy:
                continue
            if 0 <= x + xx < len(grid) and 0 <= y + yy < len(grid(x)):
                yield x + xx, y + yy

def dfs(x, y, seen, word = ''):
    """
    Recursive Generator that performs a dfs on the word grid
    seen = set of seen co-ordinates, set of tuples
    word = word to yield at each recursive call
    """
    if (x, y) in seen:
        return
    yield word + grid(x)(y)
    seen.add((x, y))
    for xx, yy in possible_directions(x, y):
        yield from dfs(xx, yy, seen.copy(), word + grid(x)(y))



grid = (('c', 'f', 'u', 'c'), ('e', 'a', 't', 'e'), ('b', 'h', 'p', 'y'), ('o', 'n', 'e', 'p')) # word grid, can be any size, n x n

for x in range(len(grid)):
    for y in range(len(grid(x))):
        for i in dfs(x, y, set()):
            print(i)

Best practice for comma separated input size for the search field

So to reiterate:

  • Users have .csvs or other files where large numbers of IMEis are listed
  • They need to be able to search for these IMEIs in your system

Ideally you’d have access to analytics or user interviews that could help you define the upper limit users search. It sounds like you don’t have access to either, so in the meantime we can make a few assumptions.

As you said, it seems the most likely scenario is that they’ll be copying and pasting these numbers, as they are difficult to correctly input due to their length. They likely won’t be checking their work, again due to length, so displaying the pasted content is mostly irrelevant – you can display “1234567890abcde, 1234567890abcde, and 498 more“, which should give them enough information about their search to complete their task.

The main bottleneck will likely be your backend system, not the UI. If you paste 500 IMEIs, how fast does the system respond? If it slows at any point and effects the UX, you’ve found your limit. If it responds adequately for 10,000 IMEIs, there’s little reason to limit it at all.

java – How to write springboot job to listen for a result of a search page which is PHP

Sorry guys if it is trivial, but I have no idea how to write a spring boot job that searches in a PHP web page.

So there is a PHP web page, where you can find some search field and a button which will give you the results based on the search fields.

I have always the main URL, like https://some.page.com/subpage/searchforsomething.php#
Under F12 (with a browser) I can see the following:

Request URL: https://some.page.com/subpage/searchforsomething.php
Request Method: POST
Content-Type: application/x-www-form-urlencoded

and some Form Data which holds the search filters:

some_search(search_type)(living_search_type): somedummydata

And of course a lot of other data which maybe not necessary.

I know how to write REST API applications, but I have no idea how I could write some scheduled-code to listen to the results of a PHP search site.

So is it possible somehow?

How to delete Google Chrome Omnibox Search History / Omnibox Suggestions

Whenever I type a non-address-text into Googles Search Bar, it seems to save it and present it to me in the future (the entries with the clock icon).

My “web & app activity” is set to “off” and there is no “activity history” to delete, yet the suggestions still are there and every term I search for gets added.

How do I prevent Chrome from saving these, for good?