Category : search

I installed Elasticsearch in laravel and need to get more than 10 result and paginate them. I am not able to get what should be code in laravel to get the desired result. below is my Post request Code Route::post(‘search’, ‘[email protected]’); Search Post request Code: public function search(Request $request){ $searchresult = Product::search($request->input(‘search’))->get(); return $searchresult; } ..

Read more

i am using Laravel 8 and perform search operation. I am searching data on base of (Vendor id,Date,Amount). It is possible if three option exist or one. I have tried and i see my attempt is not good. My code is if ($request->has(‘date’) && $request->has(‘vendor’) && $request->has(‘amount’)){ return Auth::user()->invoices()->whereDate(‘invoice_date’, Carbon::parse($request->date)) ->where(‘invoice_net_total’, $request->amount) ->where(‘vendor_id’, $request->vendor) ->get(); ..

Read more

i have one model with one relation, +—+———-+ | job_positons | +—+———-+ | id | title | +—+———-+ | 1 | Manager| +—+———-+ +—+———-+ +—+———-+ | users | +——————————-+ | id | first_name | family_name | +——————————-+ | 1 | Mike | Taylor | +——————————-+ in job_position model i wanna do search method on it ..

Read more

I addedd <tfoot> on my table and the change of table is 2x more than before: <div class="container"> <table class="table table-bordered" id="users-table" style="white-space: nowrap; margin: auto;"> <thead class="table-primary"> <tr> <th>First Name</th> <th>Verified Status</th> <th>User Type</th> <th>Birthdate</th> <th>Email</th> <th>Fiscal ID</th> <th>Actions</th> </tr> </thead> <tfoot class="table-info"> <tr> <th>First Name</th> <th>Verified Status</th> <th>User Type</th> <th>Birthdate</th> <th>Email</th> <th>Fiscal ID</th> ..

Read more

I am trying to search and from single table its working perfectly, but when I am joining two tables for search, its not working properly. Here is my code in Model : public function cities() { return $this->hasMany(City::class, ‘id’); } public static function scopeSearch($query, $searchTerm) { if(!is_null($searchTerm)){ $words = explode(‘ ‘,$searchTerm); return $query->where(function ($q) use($words) ..

Read more

when i search in search box "love quotes" its shows first "love" tags and then "motivational quotes" and then "inspirational quotes" because tag table all are already in this sequence. But, when i search in search box "quotes love" its show same, i want according to words it provide me result as well. $string = ..

Read more

I have a problem with my search method in Laravel 6, My database have a table products and my search method look for the slug attribute to do the trick, the problem is when I search for a product name in other order. Have this product ‘FONE XIAOMI’, and If I search like this way, ..

Read more

When opening a create or edit pop-up in a jQgrid, i run <script>$("table[id^=userGrid], table#userGrid").trigger("reloadGrid"); </script> to reset the filter/search. This seems to work, but when i try to search something after i close the popup. The search gives me no results unless i refresh the page. I tried to reload the grid using $("table[id^=userGrid], table#userGrid").trigger("reloadGrid"); ..

Read more

I have a table organisations with a number of columns, namely id, name, created_at and updated_at. In my Organisation model, I added a custom attribute by adding the following code in the model: // Add custom attributes protected $appends = [ ‘device_count’, ]; and: public function getDeviceCountAttribute() { // Count organisation’s devices $device_count = Device::where(‘organisation_id’, ..

Read more

I am searching the jobs with title successfully from the jobs_table. It has id, title, city_id, created_at. I have another table naming cities having id, name. I just want to add both the tables and search by name of the city also. Job Model query: public static function scopeSearch($query, $searchTerm) { return $query->where(‘job_title’, ‘like’, ‘%’ ..

Read more

I m new to MongoDB, for me I need to search the name " Raja Sekar " from name field in the database, I have indexed it. But my condition is search term should match 75 percent of similar records. Can you please help me with this db.customers.find({$text: {$search: "raja sekar kumar"}}, {score: {$meta: "textScore"}}).sort({score:{$meta:"textScore"}}) ..

Read more

Trying to make a partial search on an indexed field. I use Laravel 6.9. I ‘ve created a field for every document in my collection that consists of the data of 5 other fields seperated with a ~. For example name~surname~address~phone~mobile. I created just one field so that i can make the search faster. This ..

Read more

I have job_sector table in which sector_id and job_id fields are there. I just want to search job_id by the sectors which I have selected through checkbox. One may select multiple sectors. My model : public function scopeSelectedOptions($query, $input = []) { if(!empty($input)) { if(array_key_exists(‘sector_id’, $input)) { $query->whereHas(‘sector_id’, function($q) use ($input) { return $q->whereIn(‘sector_id’, $input[‘sector_id’]); ..

Read more

I have sector table in which sector_id and job_id is there. I just want to search job_id by the sectors which I have selected through checkbox. I may select multiple sectors. My model : public function scopeSelectedOptions($query, $input = []) { if(!empty($input)) { if(array_key_exists(‘sector_id’, $input)) { $query->whereHas(‘sector_id’, function($q) use ($input) { return $q->whereIn(‘sector_id’, $input[‘sector_id’]); }); ..

Read more