Category : search

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

I’m doing a search a month, but I can’t find anything. Start is a column of type date, 2020-07-23. Controller: public function cityName(Request $request, City $city) { $month = $request->month; $status = $request->status; if (!empty($month)) { $chamado = Chamados::where(‘cite_id’, $city->id) ->whereMonth(‘start’, $month) ->when($status, function ($query, $status) { return $query->where(‘status’, $status); })->get(); } else { $chamado ..

Read more

$students = Student::elect(‘students.*’, ‘users.email’)->join(‘users’, ‘students.user_id’, ‘users.id’)->orderBy("id", "desc")->skip($page * $pageSize)->take($pageSize); if (request(‘se’) != "" || request(‘se’) != null) { $se = request(‘se’); $se = str_replace("+", " ", $se); $students = $students ->where(function ($q) use ($se) { $q->where(‘students.student_number’, ‘like’, ‘%’ .$se. ‘%’) ->orWhere(DB::raw("CONCAT(`first_name`, ‘ ‘, `last_name`)"), ‘LIKE’, ‘%’ . $se . ‘%’) ->orWhere(‘students.gender’, $se) ->orWhere(‘students.phone’, ‘like’, ‘%’ ..

Read more

I tried to code a request with search system. Here the code: $search = request()->get(‘search’); if(Auth::user()->hasRole(‘admin’) || true) { list($orderBy, $orderDirection) = explode(‘.’, request()->get(‘sort_by’)); $prestations = Prestation::with( ‘service:id,name’, ‘facility:id,name’ ) ->orWhere(‘service:name’, ‘regexp’, “/$search/i”) ->orderBy($orderBy, $orderDirection) ->simplePaginate(50); $res = [ ‘results’ => $prestations, ‘total’ => Prestation::all()->count(), ]; return $res; } The problem is that I don’t ..

Read more